## The licenses produced by this program are inspired by: ## Apache License (Version 2.0): https://www.apache.org/licenses/LICENSE-2.0 ## Mozilla Public License (Version 2.0): https://www.mozilla.org/en-US/MPL/2.0/ ## MIT/Expat License: https://opensource.org/licenses/MIT ## BSD licenses: https://en.wikipedia.org/wiki/BSD_licenses ## Commons Clause: https://commonsclause.com/ ## Reciprocal Public License 1.5 (RPL-1.5): https://opensource.org/licenses/RPL-1.5 ## The Parity Public License: https://licensezero.com/licenses/parity ## The Charity Public License: https://licensezero.com/licenses/charity ## Lerna black-list: https://github.com/lerna/lerna/pull/1616 ## Common Public Attribution License Version 1.0 (CPAL-1.0): https://opensource.org/licenses/CPAL-1.0 ## Eclipse Public License v2.0: https://www.eclipse.org/legal/epl-2.0/ (.module: [lux #* [control [remember (#+ to-do)] [monad (#+ do)] ["." parser] [security ["!" capability]]] [data ["." maybe] ["." error (#+ Error)] ["." text format ["." encoding]] [format ["." json]]] ["." cli (#+ program:)] ["." io (#+ IO) ("#/." monad)] [world ["." file (#+ Path File)]] [host (#+ import:)]] [/ ["/." input] ["/." output]]) (with-expansions [ (as-is "2019-04-01")] (to-do "Replace _.work with _.covered-work or _.licensed-work") (to-do "Create a short notice to add as a comment to each file in the _.work")) (import: #long java/lang/String (trim [] String)) (def: default-output-file "LICENSE") (def: (success-message output) (-> Path Text) (format "Your license has been made!" text.new-line "Check the file " output ".")) (program: [{input (cli.named "--input" cli.any)} {output (parser.default ..default-output-file (cli.named "--output" cli.any))}] (do io.monad [?done (: (IO (Error Any)) (do (error.with-error io.monad) [file (!.use (:: file.system file) input) blob (!.use (:: file content) []) document (io/wrap (do error.monad [raw-json (encoding.from-utf8 blob) json (|> raw-json (:coerce java/lang/String) java/lang/String::trim (:: json.codec decode)) license (json.run json /input.license)] (wrap (/output.license license)))) output-file (: (IO (Error (File IO))) (file.get-file io.monad file.system output))] (!.use (:: output-file over-write) (encoding.to-utf8 document))))] (case ?done (#error.Success _) (wrap (log! (success-message output))) (#error.Failure message) (wrap (log! message)))))