diff options
author | Eduardo Julian | 2020-12-09 20:42:37 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-09 20:42:37 -0400 |
commit | 893c76ad530ca0e81cd84602543c3114407f4592 (patch) | |
tree | 6d14f38c7b9f5b37809615d0dca7545b36405525 /stdlib/source/program/licentia.lux | |
parent | 8df63aae42c40ac0413ccfacc3b2e8eb72e00a15 (diff) |
Added support for "Commons Clause" to Licentia.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/licentia.lux | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/stdlib/source/program/licentia.lux b/stdlib/source/program/licentia.lux index e95c261a9..032269af3 100644 --- a/stdlib/source/program/licentia.lux +++ b/stdlib/source/program/licentia.lux @@ -13,12 +13,16 @@ (.module: [lux #* + [host (#+ import:)] [abstract [monad (#+ do)]] [control [remember (#+ to-do)] + ["." io (#+ IO) ("#\." monad)] ["." try (#+ Try)] - ["." parser] + ["." parser + ["." cli (#+ program:)] + ["<.>" json]] [security ["!" capability]]] [data @@ -28,21 +32,19 @@ ["." encoding]] [format ["." json]]] - ["." cli (#+ program:)] - ["." io (#+ IO) ("#\." monad)] [world - ["." file (#+ Path File)]] - [host (#+ import:)]] + ["." file (#+ Path File)]]] ["." / #_ ["#." input] ["#." output]]) -(with-expansions [<expiry> "2019-04-01"] +(with-expansions [<expiry> "2021-04-01"] (to-do <expiry> "Replace _.work with _.covered-work or _.licensed-work") (to-do <expiry> "Create a short notice to add as a comment to each file in the _.work")) (import: java/lang/String - (trim [] java/lang/String)) + ["#::." + (trim [] java/lang/String)]) (def: default-output-file "LICENSE") @@ -57,23 +59,24 @@ (do io.monad [?done (: (IO (Try Any)) (do (try.with io.monad) - [file (!.use (\ file.default file) input) + [file (!.use (\ file.default file) [input]) blob (!.use (\ file content) []) - document (io\wrap (do try.monad + document (io\wrap (do {! try.monad} [raw-json (encoding.from-utf8 blob) json (|> raw-json (:coerce java/lang/String) java/lang/String::trim (:coerce Text) - (\ json.codec decode)) - license (json.run json /input.license)] - (wrap (/output.license license)))) + (\ json.codec decode))] + (|> json + (<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) (encoding.to-utf8 document))))] - (case ?done - (#try.Success _) - (wrap (log! (success-message output))) + (wrap (log! (case ?done + (#try.Success _) + (success-message output) - (#try.Failure message) - (wrap (log! message))))) + (#try.Failure message) + message))))) |