Commit Graph

124 Commits

Author SHA1 Message Date
5c87d7fa04 Allow using -? as a shorthand for -h
Given that it's quite a common switch and extremely unlikely to be already in use for something else, we can just consider it to be the same as having entered `-h` as an arg.

This adds the `?` as a valid option character name.

Fixes #1547
2024-05-29 08:38:55 +02:00
0e2ed511a5 chore: Update dependency Microsoft.NET.Test.Sdk to v17.10.0 2024-05-22 18:18:50 +02:00
68b28b57f2 chore: Update dependency Roslynator.Analyzers to v4.12.2 2024-04-27 16:42:58 +02:00
3acc90e47c Make -v|--version opt-in
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.
2024-04-25 20:28:13 +02:00
71f762f646 Add token representation to remaining arguments
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.
2024-04-23 14:10:04 +02:00
95bff47b85 Expose raw arguments on the command context 2024-04-20 22:17:31 +02:00
de04619f88 chore: Update dependency Roslynator.Analyzers to v4.12.1 2024-04-17 09:53:53 +02:00
ff7282ecb8 Adding test and update render to fix issue with rendering separator when headers are hidden fixing issue 1391. 2024-04-14 02:05:13 +02:00
eb38f76a6a Fixing #1507 AddDelegate uses an abstract type when used in a branch (#1509) 2024-04-13 13:40:12 +01:00
fc0b553a4a Revert "Fixed render issue where writeline inside status caused corrupt output #415 #694"
This reverts commit 71a5d83067.

The commit introduced major flickering when working with LiveRenderables

Fixes #1466
2024-04-01 19:47:20 +02:00
1a3249cdae Improve XmlDoc output (#1503)
* Add command description and examples in XML Output

Closes #1115
2024-03-29 20:30:59 +01:00
43f9ae92ad Pipe character for listing options - Fully implemented and tested. 2024-03-18 16:31:55 +01:00
e66d3aab2e Added NoStackTrace to ExceptionFormats (#1489) 2024-03-08 15:26:45 +00:00
d921ac6f02 Positioned Progress Tasks - Before or After Other Tasks (#1250) 2024-03-07 08:38:59 +00:00
397b742bec Add selection orompt Search (#1289)
* 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>
2024-02-25 12:57:27 +01:00
8da05bcc17 chore: Update dependency Roslynator.Analyzers to v4.11.0 2024-02-19 18:31:54 +01:00
fde9ee04cf Automatically register command settings
Closes #428
2024-02-15 21:33:51 +01:00
b6e0b2389a chore: Update dependency Verify.Xunit to v23.2.0 2024-02-15 07:45:54 +01:00
e13410861d Update dependencies to latest version 2024-02-13 09:34:00 +01:00
bf3b91a535 Don't erase the prompt text when backspacing on a secret prompt with a null mask. 2024-02-13 09:01:24 +01:00
72704529c5 Delete [UsesVerify] which has become obsolete through the latest update. 2024-02-13 08:53:16 +01:00
b21e07ea94 Update dependencies
* 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
2024-01-31 20:51:49 +01:00
703d653ec5 Adds ValueFormatter to ProgressBar 2024-01-31 17:37:05 +01:00
9cc888e5ad Make HelpProvider colors configurable (#1408) 2024-01-18 15:31:28 +01:00
d5b4621233 Fully addresses review comments 2024-01-15 19:22:34 +01:00
55c763a5c2 Completed 2024-01-15 19:22:34 +01:00
d03c10623c Unit test to reproduce the -v/--version bug 2024-01-15 19:22:34 +01:00
544e6a92df Added the ITypeResolver to the ExceptionHandler (#1411) 2024-01-06 23:34:02 +00:00
a94bc15746 Add the possibility to register multiple interceptors (#1412)
Having the interceptors registered with the ITypeRegistrar also enables the usage of ITypeResolver in interceptors.
2024-01-06 22:28:20 +00:00
c62f79eded Bump CodeAnalyses references
So we can benefit from roslyn issue 69309
and have consistent EOL sequences, even on
auto-generated using statements.
2023-11-28 00:14:54 +01:00
44300c871f fixed line-endings 2023-11-28 00:14:54 +01:00
4d6541dd14 Add back net7.0 TFM for tests 2023-11-19 12:18:22 +01:00
b1e0896a0d Add net8.0 support 2023-11-14 22:24:53 +01:00
250b1f4c9c Add localization support to help provider (#1349)
Closes #1349
2023-11-11 00:22:52 +01:00
c448d0d5f6 (#1313) Add TypeRegistrarBaseTests for the FakeTypeRegistrar
So it also works according to our assumptions.
2023-11-11 00:09:08 +01:00
bbf58ee814 (#1188) Rows measure greedy 2023-10-19 07:46:12 +02:00
5296e56b1c Fix DefaultValue for FileInfo and DirectoryInfo (#1238)
Commit d3f4f5f208 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!
2023-09-21 12:05:42 +01:00
943c045fab Fixes TextPath rendering bugs (#1308)
* 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
2023-09-18 08:04:57 +02:00
3bee7212b7 Merge pull request #1303 from nils-a/feature/GH-684 2023-09-16 19:37:00 +02:00
c82d8c4523 Add option to show separator between table rows (#1304)
* Add option to show separator between table rows
* Panels should show header if borders are not shown

Closes #835
2023-09-16 18:49:12 +02:00
bef21e8a21 (#684) Enable setting the color of the values in a BreakdownChart 2023-09-15 20:12:06 +02:00
cec5fb4595 Render tables with zero-width columns (#1197)
Fixes https://github.com/spectreconsole/spectre.console/issues/361
2023-09-12 15:46:25 +02:00
131b37fff8 Allow custom help providers (#1259)
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.
2023-09-08 09:51:33 +02:00
2af901a814 Remove unnecessary [NotNull] attributes
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.
2023-07-12 15:26:12 +02:00
e0ded712e8 Add fix to avoid exception on Rows with no children 2023-06-13 00:36:06 +02:00
71a5d83067 Fixed render issue where writeline inside status caused corrupt output #415 #694 2023-06-04 20:31:12 +02:00
35ce60b596 Implemented AddAsyncDelegate (#766) 2023-05-25 11:31:01 +01:00
0ec70a44db Async command unit tests 2023-05-19 17:19:17 +01:00
404b052a5f Add ability to pass example args using params syntax (#1166) 2023-05-12 12:08:42 +01:00
dac2097321 Add support for arrays in [DefaultValue] attributes (#1164)
Fixes #1163
2023-05-11 14:26:53 +01:00