diff options
author | Eduardo Julian | 2020-12-10 22:29:32 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-10 22:29:32 -0400 |
commit | 9af671a34728b35c48bff2ba163c371dc5084946 (patch) | |
tree | ec35f32b8f0cabec702708e0e3cc4462b587c752 /stdlib/source/lux/world/program.lux | |
parent | d747aada2d6df6538d0a88d70169f3757aef50af (diff) |
Render XML to text in an indented form for human readability.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/world/program.lux | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/stdlib/source/lux/world/program.lux b/stdlib/source/lux/world/program.lux index 486e5b7b6..eb8a05f9c 100644 --- a/stdlib/source/lux/world/program.lux +++ b/stdlib/source/lux/world/program.lux @@ -26,6 +26,8 @@ (: (-> Any (! Environment)) environment) (: (-> Any (! Path)) + home) + (: (-> Any (! Path)) directory) (: (-> Exit (! Nothing)) exit)) @@ -35,17 +37,21 @@ (structure (def: environment (|>> (\ program environment) promise.future)) + (def: home + (|>> (\ program home) promise.future)) (def: directory (|>> (\ program directory) promise.future)) (def: exit (|>> (\ program exit) promise.future)))) -(def: #export (mock environment directory) - (-> Environment Path (Program IO)) +(def: #export (mock environment home directory) + (-> Environment Path Path (Program IO)) (let [@dead? (atom.atom false)] (structure (def: environment (function.constant (io.io environment))) + (def: home + (function.constant (io.io home))) (def: directory (function.constant (io.io directory))) (def: (exit code) @@ -77,6 +83,7 @@ (import: java/lang/System ["#::." (#static getenv [] (java/util/Map java/lang/String java/lang/String)) + (#static getProperty [java/lang/String] #? java/lang/String) (#static exit [int] #io void)]) (def: (jvm\\consume f iterator) @@ -112,11 +119,13 @@ (for {@.old <jvm> @.jvm <jvm>}))) + (def: (home _) + (with-expansions [<jvm> (io.io (maybe.default "" (java/lang/System::getProperty "user.home")))] + (for {@.old <jvm> + @.jvm <jvm>}))) + (def: (directory _) - (with-expansions [<jvm> (\ io.monad map - (|>> (dictionary.get "user.dir") - (maybe.default "")) - ..jvm\\environment)] + (with-expansions [<jvm> (io.io (maybe.default "" (java/lang/System::getProperty "user.dir")))] (for {@.old <jvm> @.jvm <jvm>}))) |