Files
cli/examples/simple.carp
2020-01-29 11:23:00 +01:00

11 lines
446 B
Plaintext

(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 flags)
(println* &(str &(Map.get &flags "flag")) " " &(str &(Map.get &flags "thing")))
(Result.Error msg) (do (IO.errorln &msg) (CLI.usage &p)))))