Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Support unknown options #825

Closed
patriksvensson opened this issue Sep 17, 2016 · 1 comment
Closed

Support unknown options #825

patriksvensson opened this issue Sep 17, 2016 · 1 comment

Comments

@patriksvensson
Copy link

I would like to capture unknown options for a tool, that will be sent to another tool that takes arbitrary parameters used in a script. Is this possible somehow?

Example

This is what invocation could look like:

> mytool.exe --verbosity diagnostic --unknown value1 value2 --unknownflag --hello world

Where --unknown value1 value2 --unknownflag --hello world are parameters sent to the script.

And this is what I would want to do when parsing:

var result = ArgumentSyntax.Parse(args, syntax =>
{
    syntax.AllowUnknownOptions = true;
    syntax.DefineOption("v|verbosity", Verbosity.Normal, VerbosityParser.Parse);
});

IDictionary<string, IList<string>> unknown = result.GetUnknownOptions();

I understand that something like this might be out of scope for what you're building here, and I'm not even sure if the API that I've proposed makes any sense outside of my needs, but I thought I would ask.

If this is something that is of interest, I would be more than happy to provide a PR.

@bricelam
Copy link
Contributor

I want this too. Except it's probably enough just to retrieve them as IEnumerable<string>--the same way they went in.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants