Skip to content

Commit 02878fb

Browse files
committed
Merge branch 'PR #493' into develop
2 parents 375d5db + dfb3098 commit 02878fb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

demo/fsharp-demo.fsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ let formatLong o =
2222
let formatInput (o : options) =
2323
sprintf "--stringvalue: %s\n-i: %A\n-x: %b\nvalue: %s\n" o.stringValue o.intSequence o.boolValue (formatLong o.longValue)
2424

25-
let inline (|Success|Fail|) (result : ParserResult<'a>) =
25+
let inline (|Success|Help|Version|Fail|) (result : ParserResult<'a>) =
2626
match result with
2727
| :? Parsed<'a> as parsed -> Success(parsed.Value)
28+
| :? NotParsed<'a> as notParsed when notParsed.Errors.IsHelp() -> Help
29+
| :? NotParsed<'a> as notParsed when notParsed.Errors.IsVersion() -> Version
2830
| :? NotParsed<'a> as notParsed -> Fail(notParsed.Errors)
2931
| _ -> failwith "invalid parser result"
3032

@@ -34,3 +36,4 @@ let result = Parser.Default.ParseArguments<options>(args)
3436
match result with
3537
| Success(opts) -> printf "%s" (formatInput opts)
3638
| Fail(errs) -> printf "Invalid: %A, Errors: %u\n" args (Seq.length errs)
39+
| Help | Version -> ()

0 commit comments

Comments
 (0)