aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
authorEduardo Julian2016-12-02 09:59:01 -0400
committerEduardo Julian2016-12-02 09:59:01 -0400
commit55e411f34d81d8deb0b7d0e25c987dbe16035354 (patch)
tree3283bb573f7b0b2f85c3eea6c8c0d44ae33778f4 /stdlib/source
parentf7097aee6854d255849c61b1f29fc62988a790da (diff)
- Updated lux/cli tests.
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/cli.lux23
1 files changed, 11 insertions, 12 deletions
diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux
index d9039df13..459d6926f 100644
--- a/stdlib/source/lux/cli.lux
+++ b/stdlib/source/lux/cli.lux
@@ -71,24 +71,23 @@
(#;Right [inputs' arg])
_
- (#;Left "Can't extract from empty arguments."))))
+ (#;Left "Can't parse empty arguments."))))
-(def: #export (parse parser option)
+(def: #export (parse parser)
{#;doc "Parses the next input with a parsing function."}
- (All [a] (-> (-> Text (Error a)) (CLI Text) (CLI a)))
+ (All [a] (-> (-> Text (Error a)) (CLI a)))
(lambda [inputs]
- (case (option inputs)
- (#;Right [inputs' input])
- (case (parser input)
+ (case inputs
+ (#;Cons arg inputs')
+ (case (parser arg)
(#;Right value)
(#;Right [inputs' value])
(#;Left parser-error)
(#;Left parser-error))
-
- (#;Left option-error)
- (#;Left option-error)
- )))
+
+ _
+ (#;Left "Can't parse empty arguments."))))
(def: #export (option names)
{#;doc "Checks that a given option (with multiple possible names) has a value."}
@@ -126,8 +125,8 @@
#;Nil (#;Right [inputs []])
_ (#;Left (Text/append "Unknown parameters: " (text;join-with " " inputs))))))
-(def: #export (assert test message)
- (-> Bool Text (CLI Unit))
+(def: #export (assert message test)
+ (-> Text Bool (CLI Unit))
(lambda [inputs]
(if test
(#;Right [inputs []])