Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Syntax of templates #537

Open
vmelamed opened this issue Aug 2, 2023 · 1 comment
Open

[Question] Syntax of templates #537

vmelamed opened this issue Aug 2, 2023 · 1 comment
Labels
documentation good first issue This seems like a good issue if you're a new contributor. question

Comments

@vmelamed
Copy link

vmelamed commented Aug 2, 2023

I could not find it so far but is there something more to templates' syntax than just: <short option>|<long option> {<value>}. For example, can I specify <short option>|<long option> [<value1>|<value2>|<value3>] (specify the three possible values for the option), or <short option>|<long option> <key>=<value>} (specify a tuple or if multiple - a dictionary), etc.

@natemcmaster natemcmaster added documentation good first issue This seems like a good issue if you're a new contributor. labels Aug 9, 2023
@natemcmaster
Copy link
Owner

This is something the documentation could clarify. But in the absence of that, here are the test cases which demonstrate currently supported syntax:

[Theory]
[InlineData("-a", "a", null, null, null)]
[InlineData("-abc", "abc", null, null, null)]
[InlineData("-a|--name", "a", null, "name", null)]
[InlineData("-a|--name <VALUE>", "a", null, "name", "VALUE")]
[InlineData("-a|--name <VALUE> <VALUE2>", "a", null, "name", "VALUE2")]
[InlineData("-a <VALUE>", "a", null, null, "VALUE")]
[InlineData("-?|-a", "a", "?", null, null)]
[InlineData("-?|-a|--name", "a", "?", "name", null)]
[InlineData("-?|-a|--name <VALUE>", "a", "?", "name", "VALUE")]
[InlineData("-?|-a <VALUE>", "a", "?", null, "VALUE")]
[InlineData("-? <VALUE>", null, "?", null, "VALUE")]
[InlineData("-a --name", "a", null, "name", null)]
[InlineData("-a --name <VALUE>", "a", null, "name", "VALUE")]
[InlineData("-a -? --name <VALUE>", "a", "?", "name", "VALUE")]
[InlineData("--name:<VALUE>", null, null, "name", "VALUE")]
[InlineData("--name=<VALUE>", null, null, "name", "VALUE")]
[InlineData("-a:<VALUE> --name:<VALUE>", "a", null, "name", "VALUE")]
[InlineData("-a=<VALUE> --name=<VALUE>", "a", null, "name", "VALUE")]
public void ItParsesSingleValueTemplate(string template, string shortName, string symbolName, string longName, string valueName)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation good first issue This seems like a good issue if you're a new contributor. question
Projects
None yet
Development

No branches or pull requests

2 participants