std/env documentation

std/env▲toc

Access to the program environment and commmand line arguments.

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

fun get-args(): ndetstd/core/ndet: X 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 arguments list will be ["--flag","bla"].

fun get-argv(): ndetstd/core/ndet: X 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",...].

fun get-env(): ndetstd/core/ndet: X dictstd/dict/dict: V -> V<stringstd/core/string: V>

Get the environment variables for this program.

fun get-env( name : stringstd/core/string: V, default : ?stringstd/core/string: V ) : ndetstd/core/ndet: X stringstd/core/string: V

Returns the value of an environment variable name. Returns defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a (= "") if the environment variable was not present.