commandlineparser / commandlineparser/commandline
How to parse a command line with an an invalid parameter
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 478
- PR merge metrics
- No merged PRs in 30d
Description
I want to parse command line but with the possibility of providing an incorrect parameter.
I tried for example:
```
Parser.Default.ParseArguments(Environment.GetCommandLineArgs())
.WithNotParsed(errs => {
// code for errors
})
.WithParsed(opt => {
// code for valid options
});
```
but in situation when any command line parametr is incorrect commandline parser calls only code for errors handling ( "code for errors" in my example).
So how to handle valid parameters and skip incorrect?
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is named. Start by tracing Parser.Default.ParseArguments(Environment.GetCommandLineArgs()) and the WithNotParsed and WithParsed callbacks to understand the current behavior; done would require an agreed way to process valid parameters while handling invalid ones.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100