We added an automatic version option in 0.49. We did this with good
intentions, but forgot that people might already use --version
as an option for a root command.
This commit makes -v|--version completely opt-in.
Before, when adding parsed information to the IRemainingArguments.Parsed,
we used the name of the parsed option ('foo') instead of it's
representation ('--foo'). This commit fixes that.
* Add selection prompt search as you type
* Fix small bug
* Simplify
* Simplify
* Remove spacebar as a selection prompt submit key
* Trigger CI
* Update src/Spectre.Console/Prompts/SelectionPrompt.cs
Co-authored-by: Martin Costello <martin@martincostello.com>
* Simplifty Mask method
* Handle multi-selection prompt better
* Update API naming
* Address feedback
* Add some tests
* Remove whitespace
* Improve search and highlighting
* Add test case for previous issue
* Add extra test case
* Make prompt searchable
---------
Co-authored-by: Martin Costello <martin@martincostello.com>
Co-authored-by: Patrik Svensson <patrik@patriksvensson.se>
* Add support for C# 12
* Run all tests on all major .NET SDKs
* Only build on Ubuntu
* Do not build docs for pull requests
* Add Cédric Luthi, and Frank Ray to authors
* Drop netstandard2.0 for ImageSharp plugin
Commit d3f4f5f208ee76a22ff39c13df4d150712685f5f introduced automatic conversion to FileInfo and DirectoryInfo but failed to properly handle the conversion if the value comes from the [DefaultValue] attribute.
Using both `var (converter, stringConstructor) = GetConverter(...)` and `var (converter, _) = GetConverter(...)` should have been a red flag!
* Do not emit line break when rendering
* Don't be greedy when measuring.
* Fix a condition that decides if the path fits in the allotted space.
Closes#1307
Allow custom help providers
* Version option will show in help even with a default command
* Reserve `-v` and `--version` as special Spectre.Console command line arguments (nb. breaking change for Spectre.Console users who have a default command with a settings class that uses either of these switches).
* Help writer correctly determines if trailing commands exist and whether to display them as optional or mandatory in the usage statement.
* Ability to control the number of indirect commands to display in the help text when the command itself doesn't have any examples of its own. Defaults to 5 (for backward compatibility) but can be set to any integer or zero to disable completely.
* Significant increase in unit test coverage for the help writer.
* Minor grammatical improvements to website documentation.
When subclassing `Command<TSettings>` which has the [NotNull] attributes, Rider/ReSharper gives this warning:
> Nullability of type of parameter 'context' in method does not match overridden member `int Spectre.Console.Cli.Command<TSettings>.Execute(CommandContext, TSettings)` (possibly because of nullability attributes)
When subclassing `Command<TSettings>` which does not have the [NotNull] attributes, Rider/ReSharper gives this warning:
> The nullability attribute has no effect and can be safely removed
The solution is simply to remove the [NotNull] attributes.
Since `<Nullable>enable</Nullable>` is set in the project, they are actually not necessary. By the way, the non-generic `Command` class does not have the [NotNull] attributes.
Add support for converting command parameters that doesn't have a built-in TypeConverter but has a constructor that takes a string. For CLI apps, FileInfo and DirectoryInfo will likely be the most useful ones, but there may be others.