From 86df87512966e8038d70624ab654262ce14a915c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 12 Jul 2021 00:03:36 -0400 Subject: Better syntax for parallel-hierarchy imports. --- licentia/commands.md | 6 +++--- licentia/project.lux | 4 ++++ licentia/source/program/licentia.lux | 16 +++++++--------- 3 files changed, 14 insertions(+), 12 deletions(-) (limited to 'licentia') diff --git a/licentia/commands.md b/licentia/commands.md index b852e22cf..435a2fd57 100644 --- a/licentia/commands.md +++ b/licentia/commands.md @@ -1,4 +1,4 @@ -## Build +# Build ``` ## Develop @@ -7,7 +7,7 @@ cd ~/lux/licentia/ \ && lux auto build ``` -## Test +# Test ``` ## Develop @@ -16,7 +16,7 @@ cd ~/lux/licentia/ \ && lux auto test ``` -## Run +# Run ``` ## Re-generate Lux's license. diff --git a/licentia/project.lux b/licentia/project.lux index 9e8a3282f..6c31af881 100644 --- a/licentia/project.lux +++ b/licentia/project.lux @@ -9,6 +9,10 @@ #dependencies [["com.github.luxlang" "stdlib" "0.6.0-SNAPSHOT" "jar"]] #compiler ["com.github.luxlang" "lux-jvm" "0.6.0-SNAPSHOT" "jar"] + ## #compiler ["com.github.luxlang" "lux-js" "0.6.0-SNAPSHOT" "js"] + ## #compiler ["com.github.luxlang" "lux-python" "0.6.0-SNAPSHOT" "jar"] + ## #compiler ["com.github.luxlang" "lux-lua" "0.6.0-SNAPSHOT" "jar"] + ## #compiler ["com.github.luxlang" "lux-ruby" "0.6.0-SNAPSHOT" "jar"] #program "program/licentia" #test "test/licentia"} diff --git a/licentia/source/program/licentia.lux b/licentia/source/program/licentia.lux index f1a1503b4..44babb828 100644 --- a/licentia/source/program/licentia.lux +++ b/licentia/source/program/licentia.lux @@ -36,7 +36,7 @@ [format ["." json]]] [world - ["." file (#+ Path File)]]] + ["." file]]] ["." / #_ ["#." input] ["#." output]]) @@ -49,10 +49,11 @@ ["#::." (trim [] java/lang/String)]) -(def: default_output_file "LICENSE") +(def: default_output_file + "LICENSE.txt") (def: (success_message output) - (-> Path Text) + (-> file.Path Text) (format "Your license has been made!" text.new_line "Check the file " output ".")) @@ -62,8 +63,7 @@ (do io.monad [?done (: (IO (Try Any)) (do (try.with io.monad) - [file (!.use (\ file.default file) [input]) - blob (!.use (\ file content) []) + [blob (\ file.default read input) document (io\wrap (do {! try.monad} [raw_json (\ utf8.codec decode blob) json (|> raw_json @@ -71,10 +71,8 @@ (\ json.codec decode))] (|> json (.run /input.license) - (\ ! map /output.license)))) - output_file (: (IO (Try (File IO))) - (file.get_file io.monad file.default output))] - (!.use (\ output_file over_write) (\ utf8.codec encode document))))] + (\ ! map /output.license))))] + (\ file.default write (\ utf8.codec encode document) output)))] (wrap (debug.log! (case ?done (#try.Success _) (success_message output) -- cgit v1.2.3