You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple F# program that works for all defined command-line options. However, when I run the application with --help I get an exception:
Unhandled Exception: System.Exception: CommandLine.Error[]
at Program.main(String[] argv) in D:\Projects\Test\FSharp\StoryLib\StoryUpdate\Program.fs:line 46
This line is the last line in the match of the parsing result.
In addition, using the two match options shown in the docs I get a warning about an incomplete pattern match on the expression. It appears that there should be more than
match args with
| :? Parsed<Options> as parsed -> doActions parsed.Value
| :? NotParsed<Options> as notParsed -> failwith (notParsed.Errors |> string)
// should there be a third option here?
The text was updated successfully, but these errors were encountered:
The --help and --version options are treated as NotParsed. But there are extension methods for the errors to detect if the NotParsed result included a --help or --version.
Here is what you need...
match args with
| :? Parsed<Options> as parsed -> doActions parsed.Value
| :? NotParsed<'a> as notParsed when notParsed.Errors.IsHelp() -> ()
| :? NotParsed<'a> as notParsed when notParsed.Errors.IsVersion() -> ()
| :? NotParsed<Options> as notParsed -> failwith (notParsed.Errors |> string)
I have a simple F# program that works for all defined command-line options. However, when I run the application with --help I get an exception:
This line is the last line in the
match
of the parsing result.In addition, using the two match options shown in the docs I get a warning about an incomplete pattern match on the expression. It appears that there should be more than
The text was updated successfully, but these errors were encountered: