IgnoreUnknownArguments does not work for values
See original GitHub issueIssue by cdmihai Wednesday Aug 09, 2017 at 20:14 GMT _Originally opened as https://github.com/gsscoder/commandline/issues/467_
Given the following snippet where ParserSettings.IgnoreUnknownArguments = false
:
using System;
using CommandLine;
namespace Cmd
{
class Program
{
static void Main(string[] args)
{
var parser = new Parser(with =>
{
with.IgnoreUnknownArguments = false;
with.HelpWriter = Console.Out;
});
var result = parser.ParseArguments<Options>(args);
result.WithParsed(options => Console.WriteLine(options.anInt));
}
}
class Options {
[Option('i', HelpText = "an int")]
public int anInt { get; set; }
}
}
And given the invocation:
app.exe bogus args
I would expect the parser to error out saying it does not understand the unknown arguments bogus args
.
Instead, it does not error out.
Context: I have an optional argument (e.g. -a value
) and I had forgotten to type in the argument name (-a
), I typed in just the value. Instead of having the command line parser fail on encountering value
, it continued working, causing quite a bit of debugging time 😃
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
Apache Commons CLI 1.3.1: How to ignore unknown ...
I used to work with Apache Commons Cli 1.2. I wanted the parser to ignore arguments if they are unknown (not added to...
Read more >How to handle invalid arguments with argparse in Python?
To use this a variable that refers to the argument should be set up. Look at the example below. The program takes two...
Read more >Parsing arguments and building values
The variables which correspond to optional parameters not given by args will not be filled in; these should be initialized by the caller....
Read more >Function arguments - Manual
A function may define default values for arguments using syntax similar to assigning a variable. The default is used only when the parameter...
Read more >jsonargparse — jsonargparse documentation
First, the purpose is not allowing to call any python object from the command line. It is only intended for running functions and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I have the same issue… It is planned to be fixed ?
Thanks for advance Sybaris
This is needed when you need to pass through args to third party tool like Unity Engine.