Files
cli/examples/simple.carp
2019-10-14 20:29:39 +02:00

10 lines
403 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 p) (IO.println &(str &(CLI.get &p "--flag")))
(Result.Error msg) (do (IO.errorln &msg) (CLI.usage &p)))))