std/env documentation

std/env▲toc

Access to the program environment and commmand line arguments.

Print the environment: env.list.map(fun(p) { p.fst + "=" + p.snd }).join("\n").print

Note: we view the environment and command line as (total) constants in the program. i.e. as if the program is only compiled at the point when both the environment and command line is supplied.

val arguments: liststd/core/list: V -> V<stringstd/core/string: V>

Return the arguments that were passed to program itself. Strips off the initial program from the unprocessed command line. i.e. If a program started as:

node myprogram.js –flag bla

The argumentsstd/env/arguments: list<string> list will be ["--flag","bla"].

val argv: liststd/core/list: V -> V<stringstd/core/string: V>

The unprocessed command line that was used to start this program. On ‘'Node’' the first arguments will often be of the form ["node","interactive.js",...].

val env: dictstd/dict/dict: V -> V<stringstd/core/string: V>

The environment variables for this program.

fun getEnv( name : stringstd/core/string: V, default : ?stringstd/core/string: V ) : stringstd/core/string: V

Returns the value of an environment variable name. Returns default (= "") if the environment variable was not present.