diff --git a/Core/NetArgumentParser/Subcommands/ParserQuantum.cs b/Core/NetArgumentParser/Subcommands/ParserQuantum.cs index 7f399db..73dccb7 100644 --- a/Core/NetArgumentParser/Subcommands/ParserQuantum.cs +++ b/Core/NetArgumentParser/Subcommands/ParserQuantum.cs @@ -209,6 +209,28 @@ public IEnumerable FindOptions( return foundOptions.Concat(recursiveFoundOptions); } + public bool FindFirstOptionByLongName(string longName, bool recursive, out ICommonOption? foundOption) + { + IEnumerable foundOptions = FindOptions(t => t.LongName == longName, recursive); + foundOption = foundOptions.FirstOrDefault(); + + return foundOption is not null; + } + + public bool FindFirstValueOptionByLongName( + string longName, + bool recursive, + out IValueOption? foundOption) + { + IEnumerable foundOptions = FindOptions( + t => t.LongName == longName && t is IValueOption, + recursive); + + foundOption = foundOptions.FirstOrDefault() as IValueOption; + + return foundOption is not null; + } + protected virtual void AddDefaultOptions() { foreach (ParserQuantum quantum in _subcommands.Concat([this])) diff --git a/Documentation/ParserGenerationUsingAttributes.md b/Documentation/ParserGenerationUsingAttributes.md index bf80a89..e672389 100644 --- a/Documentation/ParserGenerationUsingAttributes.md +++ b/Documentation/ParserGenerationUsingAttributes.md @@ -289,7 +289,7 @@ Using attributes in C# imposes a restriction on their argument types. An attribu - `MultipleValueOption` choices. - Custom after handing action and after value parsing action. -However, you can find the option using `FindOptions()` method and further configure it. +However, you can find the option using `FindOptions()`, `FindFirstOptionByLongName()`, or a similar method, and then configure it. ```cs var generator = new ArgumentParserGenerator(); diff --git a/TODO.md b/TODO.md index 32590b9..81ee97e 100644 --- a/TODO.md +++ b/TODO.md @@ -3,3 +3,6 @@ This is the TODO file where you can find some features and content that need to ## Features - [ ] Come up with new features. +- [ ] Add mutually inclusive groups. +- [ ] Add the ability to sort options (by name, by weight, etc) in application description generator. +- [ ] Add XML documentation.