Commit Graph
22 Commits
Author SHA1 Message Date
Phil ScottandPatrik Svensson 79af013bf2 Expanding CLI docs
Adding new pages for commandApp, commands and settings.
2021-04-21 17:51:59 +02:00
Phil ScottandPatrik Svensson f5a9c0ca26 Removes automatic registration of settings
Original intention was to register Settings automatically for DI. This ran into problem when the container verifies the configuration is valid for a settings using the constructor for initialization. It tries to resolve the parameters and fails.

This removes the automatic registration and falls back ActivatorCreateInstance when no Setting is registered.
2021-04-18 22:41:05 +02:00
Phil ScottandPatrik Svensson f2b8afffb3 Marks Spectre.Console.Testing as not a test project
Probably something that only bothers me, but I'm in a habit of running dotnet test at the solution level. It was discovering this project as a test project even though it isn't. This produces an error complaining about not having a testhost.dll. I'm pretty sure this comes in via a props when xunit is referenced. 

This attribute in the csproj marks the project explicitly as not a test project
2021-04-17 09:30:33 +02:00
Phil ScottandPatrik Svensson bc9f610258 Added "--hidden" param to explain feature
Probably shouldn't include the hidden commands by default. This lets the user show them if needed.
2021-04-13 17:40:55 +02:00
Phil ScottandPatrik Svensson ae96606ab7 Adds default command to explain feature 2021-04-13 17:40:55 +02:00
Phil ScottandPatrik Svensson 41ccc0b464 Adds CLI explain command
Wanted a command to break down how Spectre views the command model. This outputs all the relevant settings in a tree. You can get a short explanation for all the commands, or a detailed explanation for all commands (there is a flag to go vice versa on the detailed view if you want)

app cli explain
app cli explain myappcommand
app cli explain -d
2021-04-12 17:40:31 +02:00
Phil ScottandPatrik Svensson 36ec3d1fd3 Adds rune width caching for cell length calculations 2021-04-07 23:59:23 +02:00
Phil ScottandPatrik Svensson 8cf7794852 Adding unit tests for settings constructor 2021-04-06 22:48:51 +02:00
Phil ScottandPatrik Svensson 4edc647fdd Falls back to null for settings constructor 2021-04-06 22:48:51 +02:00
Phil ScottandPatrik Svensson a690ce4955 Marks nullable bools as flags too 2021-04-05 16:14:13 +02:00
Phil ScottandPatrik Svensson 254880e93a Replaces emoji regex with ReadOnlySpan implementation
The RegEx runtime perf was never anything noticeable - it was the startup time that was eating over a third of time during initialization.

This shaves 200ms off the startup time.
2021-04-04 04:10:25 +02:00
Phil ScottandPatrik Svensson 9204671b27 Uses Environment.TickCount for seed instead of DateTime.Now 2021-04-02 18:52:18 +02:00
Phil ScottandPatrik Svensson c765bbd0dd Uses OSVersion instead of RegEx to detect Windows Build info
Perf improvement.
2021-04-02 18:51:30 +02:00
Phil ScottandPatrik Svensson b17eabaa1f Adds helper overloads for Markup calls without args
Without specific overloads without the args string.format will get called even if it's not needed. 

This closes #309
2021-03-22 19:14:59 +01:00
Phil ScottandPatrik Svensson e4dda283bb Adds overloads for MarkUp methods without args
These methods don't require a string.format call so we'll directly call the Render method without a call to string.format.

Added bonus of a a couple fewer allocations too.
2021-03-08 15:04:55 +01:00
Phil ScottandPatrik Svensson da9c6ee4c2 Add IProgress<double> to ProgressTask.cs
Makes the Report method an explicit implementation to allow for better interoperability with standard .NET progress functionality while keeping backwards compatibility with existing ProgressTask functionality.

Closes #285
2021-03-07 09:24:44 +01:00
Phil ScottandPatrik Svensson 855127f32a Changes progress task IsFinished to account for stopped tasks
Previous behavior was that the only way to get a task to a finished state was to artificially set the Value to MaxValue.

With this change StopTask() will also complete the task with the change that a task cannot be restarted.
2021-03-07 09:24:21 +01:00
Phil ScottandGitHub 1cd335e785 Serilog example for logging 2021-03-04 08:39:53 +01:00
Phil ScottandPatrik Svensson bff3438a5a using loop instead of linq
In both of these loops context is captured preventing caching of the lambda. this results in a pretty significant amount of allocations especially with progress bars that constantly are remeasuring
2021-03-01 08:22:45 +01:00
Phil ScottandPatrik Svensson 3a42c0a119 Adds DotSettings and tweaks editoconfigs for tests
R# and Rider have quite a bit of noise related to documentation in the testing projects so this disables those warnings.

In the main projects, R# and Rider complain loudly about the namespaces not matching the file structure. The DotSettings file disables that warning.

Once you get rid of that noise there are quite a few opportunities for trimming out redundant code that R# points out especially with the nullable support enabled, plus there are some bugs related to multiple enumerations worth looking into I think.
2021-02-23 22:34:33 +01:00
Phil ScottandPatrik Svensson 04d0e663d5 Extends maximum size of remaining and elapsed time displayed, plus a failsafe
Elapsed and remaining now support > 9 hours, and if a timespan can't be rendered in that size **:**:** will be displayed
2021-02-16 23:31:55 +01:00
Phil ScottandGitHub 9312663bde Adds text and Progress bar spinner column for tasks yet to be started 2021-02-14 18:03:57 +01:00