Skip to content

Commit

Permalink
environment: adding os-env? word
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Nov 20, 2024
1 parent a34c4f4 commit efda6da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion basis/environment/environment-docs.factor
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
! Copyright (C) 2008 Doug Coleman.
! See https://factorcode.org/license.txt for BSD license.
USING: assocs help.markup help.syntax io.streams.string
USING: assocs help.markup help.syntax io.streams.string kernel
libc sequences strings ;
IN: environment

Expand Down Expand Up @@ -29,6 +29,10 @@ HELP: os-env
}
} ;

HELP: os-env?
{ $values { "key" string } { "?" boolean } }
{ $description "Returns " { $link t } " if the environment variable is set to a non-empty value." } ;

HELP: change-os-env
{ $values { "key" string } { "quot" { $quotation ( old -- new ) } } }
{ $description "Applies a quotation to change the value stored in an environment variable." }
Expand Down
2 changes: 2 additions & 0 deletions basis/environment/environment.factor
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ HOOK: (set-os-envs) os ( seq -- )

HOOK: set-os-envs-pointer os ( malloc -- )

: os-env? ( key -- ? ) os-env empty? not ;

: change-os-env ( key quot -- )
[ [ os-env ] keep ] dip dip set-os-env ; inline

Expand Down

0 comments on commit efda6da

Please sign in to comment.