Moved env symbols and sigils to global.
@@ -1175,6 +1175,20 @@ i.dset(dict, "value", p.a.processTokenValue(t).newVal)
q.add dict i.push q.newVal + def.symbol("get-env") do (i: In): + let vals = i.expect("'sym") + let a = vals[0] + i.push a.getString.getEnv.newVal + + def.symbol("put-env") do (i: In): + let vals = i.expect("'sym", "'sym") + let key = vals[0] + let value = vals[1] + key.getString.putEnv value.getString + + def.symbol("$") do (i: In): + i.pushSym("get-env") + # Sigils def.sigil("'") do (i: In):@@ -1197,6 +1211,9 @@ i.pushSym("lambda")
def.sigil("~") do (i: In): i.pushSym("lambda-bind") + + def.sigil("$") do (i: In): + i.pushSym("get-env") # Shorthand symbol aliases
@@ -60,17 +60,6 @@ i.dset(d, "output", res.output.strip.newVal)
i.dset(d, "code", res.exitCode.newVal) i.push(d) - def.symbol("get-env") do (i: In): - let vals = i.expect("'sym") - let a = vals[0] - i.push a.getString.getEnv.newVal - - def.symbol("put-env") do (i: In): - let vals = i.expect("'sym", "'sym") - let key = vals[0] - let value = vals[1] - key.getString.putEnv value.getString - def.symbol("env?") do (i: In): let vals = i.expect("'sym") let s = vals[0]@@ -154,12 +143,6 @@ let vals = i.expect("'sym", "'sym")
let dest = vals[0] let src = vals[1] src.getString.createHardlink dest.getString - - def.symbol("$") do (i: In): - i.pushSym("get-env") - - def.sigil("$") do (i: In): - i.pushSym("get-env") def.symbol("unzip") do (i: In): let vals = i.expect("'sym", "'sym")
@@ -11,6 +11,7 @@ - The `/` sigil has been removed; use `dget` or symbol dot notation instead.
- The `%` sigil has been removed; use `dset` or symbol dot notation instead. - The `>` sigil has been removed; use `save-symbol` innstead. - The `<` sigil has been removed; use `load-symbol` innstead. +- Moved `get-env`, `put-env`, `$` symbol and `$` sigil from `sys` to `global` module. ### New Features
@@ -22,6 +22,10 @@ {#sig||~||lambda-bind#}
{#alias||~||lambda-bind#} +{#sig||$||get-env#} + +{#alias||$||get-env#} + {#sig||@||bind#} {#alias||@||bind#}@@ -182,6 +186,9 @@ > > At present, only YAML objects containing string values are supported.#}
{#op||gets||{{none}}||{{s}}|| Reads a line from STDIN and places it on top of the stack as a string.#} + +{#op||get-env||{{sl}}||{{s}}|| +Returns environment variable {{sl}}. #} {#op||help||{{sl}}||{{none}}|| Prints the help text for {{sl}}, if available. #}@@ -352,6 +359,9 @@ > > `'my-local-symbol global publish` #}
{#op||puts||{{any}}||{{any}}|| Prints {{any}} and a new line to STDOUT.#} + +{#op||put-env||{{sl1}} {{sl2}}||{{s}}|| +Sets environment variable {{sl2}} to {{sl1}}. #} {#op||quit||{{none}}||{{none}}|| Exits the program or shell with 0 as return code. #}
@@ -4,10 +4,6 @@ title: "sys Module"
----- {@ _defs_.md || 0 @} -{#sig||$||get-env#} - -{#alias||$||get-env#} - {#op||admin?||{{none}}||{{b}}|| Returns {{t}} if the program is being run with administrative privileges. #}@@ -33,9 +29,6 @@
{#op||env?||{{sl}}||{{b}}|| Returns {{t}} if environment variable {{sl}} exists, {{f}} otherwise. #} -{#op||get-env||{{sl}}||{{s}}|| -Returns environment variable {{sl}}. #} - {#op||hardlink||{{sl1}} {{sl2}}||{{none}}|| Creates hardlink {{sl2}} for file or directory {{sl1}}. #}@@ -56,9 +49,6 @@ Returns the host operating system. It can be one of the following strings: windows, macosx, linux, netbsd, freebsd, openbsd, solaris, aix, standalone. #}
{#op||parent-dir||{{none}}||{{s}}|| Returns the full path to the parent directory. #} - -{#op||put-env||{{sl1}} {{sl2}}||{{s}}|| -Sets environment variable {{sl2}} to {{sl1}}. #} {#op||pwd||{{none}}||{{s}}|| Returns the full path to the current directory. #}