This commit is contained in:
2019-10-14 20:29:39 +02:00
commit c5a2bb56b2
3 changed files with 129 additions and 0 deletions

9
examples/simple.carp Normal file
View File

@@ -0,0 +1,9 @@
(load "cli.carp")
(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"])))]
(match (CLI.parse &p)
(Result.Success p) (IO.println &(str &(CLI.get &p "--flag")))
(Result.Error msg) (do (IO.errorln &msg) (CLI.usage &p)))))