mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 00:09:33 +03:00
Start on parseFormatted
This commit is contained in:
parent
e7c0cad1e7
commit
9c34aac6fd
@ -197,6 +197,15 @@ parse = \@Parser parser, args ->
|
||||
WithConfig parser2 _config ->
|
||||
parse parser2 args
|
||||
|
||||
## Like [parse], runs a parser to completion on a list of arguments.
|
||||
## If the parser fails, a formatted error and help message is returned.
|
||||
parseFormatted : Parser a, List Str -> Result a Str
|
||||
parseFormatted = \parser, args ->
|
||||
when parse parser args is
|
||||
Ok a -> Ok a
|
||||
Err e ->
|
||||
Str.concat (Str.concat (formatHelp parser) "\n\n") (formatError e)
|
||||
|
||||
bool : _ -> Parser Bool # TODO: panics if OptConfig annotated
|
||||
bool = \{ long, short ? NotProvided, help ? NotProvided } ->
|
||||
fn = \args ->
|
||||
|
Loading…
Reference in New Issue
Block a user