question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Configure to allow unrecognized options and collect them together

See original GitHub issue

I am working on a project that needs to deliver some custom options (not declared in the code) to external plug-ins, however, if there are any unrecognized options, then the library terminates the program.

So I think can we have an attribute to suppress this behavior and put all of the unrecognized options into somewhere, such as CommandLineApplication.UnrecognizedOptions, just like the CommandLineApplication.RemainingArguments?

Or is there already exists a way to achieve this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Dwscdv3commented, Oct 18, 2018

I made a workaround for it, only ignored the complicated whitespace case:

RegexIsOption = new Regex(@"^\-[\w\-]*\w$");
RemainingOptions = RemainingArguments.Select(arg =>
    {
        var kv = arg.Split('=', ':');
        return new { Key = kv[0], Value = kv.ElementAtOrDefault(1) };
    })
    .Where(opt => RegexIsOption.IsMatch(opt.Key))
    .ToLookup(opt => opt.Key, opt => opt.Value);
RemainingArguments = RemainingArguments.Where(arg => !RegexIsOption.IsMatch(arg.Split('=', ':')[0]));

Not a perfect solution, but enough for me though.

0reactions
Dwscdv3commented, Oct 21, 2018

Okay, it seems like we don’t have much progress, I’ll close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

configure: WARNING: unrecognized options: --with-configfile
I think the problem you are having is due to the new-ish behaviour of Shairport Sync, which is that by default it now...
Read more >
Error with Permissions-Policy header - interest-cohort
i use this in index.html but still show this problem : Error with Permissions-Policy header: Unrecognized feature: 'ch-ua-form-factor'. – Aubdur ...
Read more >
Feature Request: Ignore unrecognized arguments #263
Would it be possible to introduce a new parser type that ignores the unrecognized arguments, flags, etc?
Read more >
Safely open apps on your Mac
The safest place to get apps for your Mac is the App Store. Apple reviews each app in the App Store before it's...
Read more >
Using the GNU Compiler Collection (GCC): Warning Options
When an unrecognized warning option is requested (e.g., -Wunknown-warning ), GCC emits a diagnostic stating that the option is not recognized.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found