From 14d25abc356dea1538a58a0611d42d82b0a40ce1 Mon Sep 17 00:00:00 2001 From: hellerve Date: Fri, 31 Jan 2020 17:28:31 +0100 Subject: [PATCH] bugfix for printing none --- cli.carp | 3 ++- examples/simple.carp | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cli.carp b/cli.carp index e1dc397..ea33926 100644 --- a/cli.carp +++ b/cli.carp @@ -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 diff --git a/examples/simple.carp b/examples/simple.carp index 6e11f04..2544f29 100644 --- a/examples/simple.carp +++ b/examples/simple.carp @@ -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)))))