bugfix for printing none

This commit is contained in:
2020-01-31 17:28:31 +01:00
parent 10ba753ee3
commit 14d25abc35
2 changed files with 7 additions and 3 deletions

View File

@@ -88,7 +88,8 @@ unset.")
(match @t
(Integer i) (str i)
(Floating f) (str f)
(Str s) (str s)))
(Str s) (str s)
(None) @"none"))
(defn to-int [x]
(match x

View File

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