initial real version

This commit is contained in:
2020-01-29 11:23:00 +01:00
parent c5a2bb56b2
commit f6af4f6c3b
2 changed files with 148 additions and 39 deletions

View File

@@ -2,8 +2,9 @@
(defn main []
(let [p (=> (CLI.new @"My super cool tool!")
(CLI.add &(CLI.option "--flag" "-f" "my flag" true))
(CLI.add &(CLI.option "--thing" "-t" "my thing" false @"hi" [@"a" @"b" @"hi"])))]
(CLI.add &(CLI.option "flag" "f" "my flag" true))
(CLI.add &(CLI.option "thing" "t" "my thing" false @"hi" [@"a" @"b" @"hi"])))]
(match (CLI.parse &p)
(Result.Success p) (IO.println &(str &(CLI.get &p "--flag")))
(Result.Success flags)
(println* &(str &(Map.get &flags "flag")) " " &(str &(Map.get &flags "thing")))
(Result.Error msg) (do (IO.errorln &msg) (CLI.usage &p)))))