From 6f7cbdd825eff4ab3e6dc46142266fb45d250908 Mon Sep 17 00:00:00 2001 From: Drew Burlingame Date: Thu, 12 Dec 2024 19:24:17 +0000 Subject: [PATCH] update docs --- .../data-annotations-validation.md | 4 +-- docs/ArgumentValidation/fluent-validation.md | 8 +++--- docs/ArgumentValues/argument-separator.md | 8 +++--- docs/ArgumentValues/piped-arguments.md | 8 +++--- docs/Arguments/argument-arity.md | 12 ++++---- docs/Arguments/argument-collections.md | 4 +-- docs/Arguments/argument-models.md | 28 +++++++++---------- docs/Arguments/argument-types.md | 14 +++++----- docs/Arguments/arguments.md | 16 +++++------ docs/Arguments/passwords.md | 8 +++--- docs/Commands/command-attribute.md | 2 +- docs/Commands/commands.md | 14 +++++----- docs/Commands/subcommands.md | 8 +++--- docs/Diagnostics/command-logger.md | 24 ++++++++-------- docs/Diagnostics/exceptions.md | 16 +++++------ .../getting-started-100-calculator.md | 2 +- .../getting-started-120-subcommands.md | 2 +- .../getting-started-140-default-commands.md | 8 +++--- .../getting-started-300-help.md | 2 +- .../getting-started-400-tests.md | 10 +++---- .../getting-started-500-interceptors.md | 4 +-- .../getting-started-600-validation.md | 4 +-- .../getting-started-700-pipes.md | 4 +-- .../getting-started-800-ctrlc.md | 4 +-- .../getting-started-next-steps.md | 2 +- docs/OtherFeatures/name-casing.md | 2 +- mkdocs.yml | 2 +- requirements.txt | 2 +- scripts/mkdocs-snippets.sh | 7 ++--- 29 files changed, 113 insertions(+), 116 deletions(-) diff --git a/docs/ArgumentValidation/data-annotations-validation.md b/docs/ArgumentValidation/data-annotations-validation.md index 1fd2bfce..7fe0ab34 100644 --- a/docs/ArgumentValidation/data-annotations-validation.md +++ b/docs/ArgumentValidation/data-annotations-validation.md @@ -22,7 +22,7 @@ Enable with `appRunner.UseDataAnnotationValidations()`, or `appRunner.UseDataAnn -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -61,7 +61,7 @@ public class Verbosity : IArgumentModel, IValidatableObject } } ``` -snippet source | anchor +snippet source | anchor DataAnnotations can be defined on the method parameters and model properties. Notice diff --git a/docs/ArgumentValidation/fluent-validation.md b/docs/ArgumentValidation/fluent-validation.md index cfa43363..5d2c131a 100644 --- a/docs/ArgumentValidation/fluent-validation.md +++ b/docs/ArgumentValidation/fluent-validation.md @@ -22,7 +22,7 @@ Enable with `appRunner.UseFluentValidation()`, or `appRunner.UseFluentValidation -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -92,7 +92,7 @@ public class VerbosityValidator : AbstractValidator } } ``` -snippet source | anchor +snippet source | anchor @@ -121,7 +121,7 @@ Register your validators with a container or provide a factory method. -```c# +```cs public static AppRunner AppRunner => new AppRunner() .UseNameCasing(Case.LowerCase) @@ -136,7 +136,7 @@ public static AppRunner AppRunner => } }); ``` -snippet source | anchor +snippet source | anchor ## vs. DataAnnotations diff --git a/docs/ArgumentValues/argument-separator.md b/docs/ArgumentValues/argument-separator.md index 63a55c3e..64e2123d 100644 --- a/docs/ArgumentValues/argument-separator.md +++ b/docs/ArgumentValues/argument-separator.md @@ -24,7 +24,7 @@ Let's look at an example. -```c# +```cs public void EndOfOptions(IConsole console, CommandContext ctx, string? arg1) { var parserSettings = ctx.AppConfig.AppSettings.Parser; @@ -38,7 +38,7 @@ public void EndOfOptions(IConsole console, CommandContext ctx, string? arg1) console.WriteLine($"remaining: {string.Join(',', ctx.ParseResult!.RemainingOperands)}"); } ``` -snippet source | anchor +snippet source | anchor This command expects a single operand, but if the operand value looks like an option, the parser will throw an exception @@ -127,7 +127,7 @@ Let's modify the EndOfOptions example using the `[Command]` attribute to set the -```c# +```cs [Command(ArgumentSeparatorStrategy = ArgumentSeparatorStrategy.PassThru)] public void PassThru(IConsole console, CommandContext ctx, string? arg1) { @@ -142,7 +142,7 @@ public void PassThru(IConsole console, CommandContext ctx, string? arg1) console.WriteLine($"remaining: {string.Join(',', ctx.ParseResult!.RemainingOperands)}"); } ``` -snippet source | anchor +snippet source | anchor Help will append ` [[--] ...]` to the usage example when `ArgumentSeparatorStrategy.PassThru` is used. diff --git a/docs/ArgumentValues/piped-arguments.md b/docs/ArgumentValues/piped-arguments.md index 413da93e..24b520e0 100644 --- a/docs/ArgumentValues/piped-arguments.md +++ b/docs/ArgumentValues/piped-arguments.md @@ -27,7 +27,7 @@ Every command is allowed a single operand collection. If one is defined and if p -```c# +```cs public void List(IConsole console, [Option('i')] bool idsOnly) { @@ -46,7 +46,7 @@ public void Disable(IConsole console, IEnumerable ids) } } ``` -snippet source | anchor +snippet source | anchor This app has two commands, one to list users and the other to disable them. The list command works like this... @@ -100,7 +100,7 @@ Let's add a Welcome command to our example app. -```c# +```cs public void Welcome(IConsole console, string userId, [Option] ICollection notify) { console.Out.WriteLine($"welcome {userSvc.Get(userId)?.Name}"); @@ -112,7 +112,7 @@ public void Welcome(IConsole console, string userId, [Option] ICollectionsnippet source | anchor +snippet source | anchor And let's welcome Cris and send a notification to the other users diff --git a/docs/Arguments/argument-arity.md b/docs/Arguments/argument-arity.md index 3f841aa8..ba168112 100644 --- a/docs/Arguments/argument-arity.md +++ b/docs/Arguments/argument-arity.md @@ -51,7 +51,7 @@ CommandDotNet will check if the minimum or maximum arity has been exceeded and r -```c# +```cs public void DefaultCommand(Model model, bool requiredBool, Uri requiredRefType, bool? nullableBool, Uri? nullableRefType, @@ -66,7 +66,7 @@ public class Model : IArgumentModel [Operand] public Uri DefaultRefType { get; set; } = new ("http://apple.com"); } ``` -snippet source | anchor +snippet source | anchor @@ -128,13 +128,13 @@ We'll use options for these because we can have only one collection operand per -```c# +```cs public void DefaultCommand( [Option('b')] bool[] requiredBool, [Option('u')] Uri[] requiredRefType, [Option] bool[]? nullableBool, [Option] Uri[]? nullableRefType, [Option] bool[] optionalBool = null, [Option] Uri[] optionalRefType = null) ``` -snippet source | anchor +snippet source | anchor @@ -181,7 +181,7 @@ requiredRefType is required -```c# +```cs public static IArgumentArity Zero => new ArgumentArity(0, 0); public static IArgumentArity ZeroOrOne => new ArgumentArity(0, 1); public static IArgumentArity ExactlyOne => new ArgumentArity(1, 1); @@ -197,7 +197,7 @@ There are several extension methods that make it easier check conditions of a gi -```c# +```cs /// > 1 public static bool AllowsMany(this IArgumentArity arity) => arity.Maximum > 1; diff --git a/docs/Arguments/argument-collections.md b/docs/Arguments/argument-collections.md index ce648193..4548976d 100644 --- a/docs/Arguments/argument-collections.md +++ b/docs/Arguments/argument-collections.md @@ -6,12 +6,12 @@ Let's enhance our rocket launcher to visit multiple planets and specify a crew. -```c# +```cs public void LaunchRocket(IConsole console, IEnumerable planets, [Option('c', "crew")] string[] crew) ``` -snippet source | anchor +snippet source | anchor Help looks like... diff --git a/docs/Arguments/argument-models.md b/docs/Arguments/argument-models.md index 97458b83..8ca2d622 100644 --- a/docs/Arguments/argument-models.md +++ b/docs/Arguments/argument-models.md @@ -6,14 +6,14 @@ Let's consider this notify command. -```c# +```cs public void Notify(string message, List recipients, [Option] bool dryrun, [Option('v')] bool verbose, [Option('q')] bool quiet) { // send notification } ``` -snippet source | anchor +snippet source | anchor @@ -53,7 +53,7 @@ Here's how they're configured -```c# +```cs public void Notify( NotificationArgs notificationArgs, DryRunOptions dryRunOptions, @@ -71,12 +71,12 @@ public class NotificationArgs : IArgumentModel public List Recipients { get; set; } = null!; } ``` -snippet source | anchor +snippet source | anchor -```c# +```cs public class DryRunOptions : IArgumentModel { [Option("dryrun")] @@ -99,7 +99,7 @@ public class VerbosityOptions : IArgumentModel, IValidatableObject } } ``` -snippet source | anchor +snippet source | anchor @@ -138,7 +138,7 @@ Using same example from above, we configure the arguments into a single model li -```c# +```cs public void Notify(NotificationArgs notificationArgs) { // send notification @@ -157,7 +157,7 @@ public class NotificationArgs : IArgumentModel public VerbosityOptions VerbosityOptions { get; set; } = null!; } ``` -snippet source | anchor +snippet source | anchor @@ -167,7 +167,7 @@ Instead of defining the model in each command method, the model could be defined -```c# +```cs public Task Interceptor(InterceptorExecutionDelegate next, CommandContext ctx, DryRunOptions dryRunOptions, VerbosityOptions verbosityOptions) { @@ -205,7 +205,7 @@ public class VerbosityOptions : IArgumentModel public bool Quite { get; set; } } ``` -snippet source | anchor +snippet source | anchor @@ -262,7 +262,7 @@ An example of invalidly nesting an IArgumentModel that contains operands -```c# +```cs public class NotifyModel : IArgumentModel { public NotificationArgs NotificationArgs { get; set; } @@ -270,7 +270,7 @@ public class NotifyModel : IArgumentModel public VerbosityOptions VerbosityOptions { get; set; } } ``` -snippet source | anchor +snippet source | anchor And the error received because NotificationArgs contains operands @@ -289,7 +289,7 @@ This is the correct way to nest a model with operands -```c# +```cs public class NotifyModel : IArgumentModel { [OrderByPositionInClass] @@ -298,7 +298,7 @@ public class NotifyModel : IArgumentModel public VerbosityOptions VerbosityOptions { get; set; } } ``` -snippet source | anchor +snippet source | anchor ### Recommendation diff --git a/docs/Arguments/argument-types.md b/docs/Arguments/argument-types.md index 561f12c2..6c09829a 100644 --- a/docs/Arguments/argument-types.md +++ b/docs/Arguments/argument-types.md @@ -11,7 +11,7 @@ The constructor and static Parse method may contain additional optional paramete -```c# +```cs public class Username { public string Value { get; } @@ -23,20 +23,20 @@ public class Username public static Username Parse(string value, DateTime? validUntil = null) => new(value, validUntil); } ``` -snippet source | anchor +snippet source | anchor Any of those constructors or Parse methods will allow conversion from string input, as shown in this example -```c# +```cs public void Login(IConsole console, Username username, Password password) { console.WriteLine($"u:{username.Value} p:{password}"); } ``` -snippet source | anchor +snippet source | anchor @@ -78,7 +78,7 @@ If the type has a limited range of acceptable values, the descriptor should also -```c# +```cs public class EnumTypeDescriptor : IArgumentTypeDescriptor, IAllowedValuesTypeDescriptor @@ -103,7 +103,7 @@ Use [DelegatedTypeDescriptor](https://github.com/bilal-fazlani/commanddotnet/blo -```c# +```cs new DelegatedTypeDescriptor(Resources.A.Type_Text, v => v), ``` snippet source | anchor @@ -113,7 +113,7 @@ See [StringCtorTypeDescriptor](https://github.com/bilal-fazlani/commanddotnet/bl -```c# +```cs public class ComponentModelTypeDescriptor : IArgumentTypeDescriptor { public bool CanSupport(Type type) diff --git a/docs/Arguments/arguments.md b/docs/Arguments/arguments.md index da1477fb..86c4e585 100644 --- a/docs/Arguments/arguments.md +++ b/docs/Arguments/arguments.md @@ -59,7 +59,7 @@ The OptionAttribute has the following properties: -```c# +```cs public void LaunchRocket( [Operand("planet", Description = "Name of the planet you wish the rocket to go")] string planetName, @@ -68,14 +68,14 @@ public void LaunchRocket( [Option('a', Description = "Abort the launch before takeoff", BooleanMode = BooleanMode.Explicit)] bool abort) ``` -snippet source | anchor +snippet source | anchor or -```c# +```cs public void LaunchRocket( [Positional("planet", Description = "Name of the planet you wish the rocket to go")] string planetName, @@ -84,7 +84,7 @@ public void LaunchRocket( [Named('a', Description = "Abort the launch before takeoff", BooleanMode = BooleanMode.Explicit)] bool abort) ``` -snippet source | anchor +snippet source | anchor and help looks like: @@ -182,10 +182,10 @@ How to enable and use with Windows -```c# +```cs new AppSettings { Parser = { AllowBackslashOptionPrefix = true } }; ``` -snippet source | anchor +snippet source | anchor @@ -201,10 +201,10 @@ How to enable and use with Powershell -```c# +```cs new AppSettings { Parser = { AllowSingleHyphenForLongNames = true } }; ``` -snippet source | anchor +snippet source | anchor diff --git a/docs/Arguments/passwords.md b/docs/Arguments/passwords.md index 56368dcc..2ecbd410 100644 --- a/docs/Arguments/passwords.md +++ b/docs/Arguments/passwords.md @@ -9,13 +9,13 @@ The `Password` type can be use to define arguments that contain confidential dat -```c# +```cs public void Login(IConsole console, string username, Password password) { console.WriteLine($"u:{username} p:{password}"); } ``` -snippet source | anchor +snippet source | anchor @@ -33,14 +33,14 @@ When using `Password` with the built-in [prompting features](../ArgumentValues/p -```c# +```cs public void Prompt(IConsole console, IPrompter prompter, string username) { var password = prompter.PromptForValue("password", out _, isPassword: true); console.WriteLine($"u:{username} p:{password}"); } ``` -snippet source | anchor +snippet source | anchor diff --git a/docs/Commands/command-attribute.md b/docs/Commands/command-attribute.md index 6acf2a2a..0860966e 100644 --- a/docs/Commands/command-attribute.md +++ b/docs/Commands/command-attribute.md @@ -6,7 +6,7 @@ Here are the constructors and properties you can use: -```c# +```cs /// The description to show in the help public string? Description { get; set; } diff --git a/docs/Commands/commands.md b/docs/Commands/commands.md index 45fb2230..c8aa66eb 100644 --- a/docs/Commands/commands.md +++ b/docs/Commands/commands.md @@ -6,7 +6,7 @@ Using our calculator example... -```c# +```cs public class Program { // this is the entry point of your application @@ -51,7 +51,7 @@ Use the `[Command]` attribute to change the command name, enhance help output an -```c# +```cs [Command("Sum", Usage = "sum [ ...]", Description = "sums all the numbers provided", @@ -59,7 +59,7 @@ Use the `[Command]` attribute to change the command name, enhance help output an public void Add(IConsole console, IEnumerable numbers) => console.WriteLine(numbers.Sum()); ``` -snippet source | anchor +snippet source | anchor @@ -92,7 +92,7 @@ Use `Description` & `ExtendedHelpText` to include additional information in help -```c# +```cs ExtendedHelpText = "Directives:\n" + " [debug] to attach a debugger to the app\n" + " [parse] to output how the inputs were tokenized\n" + @@ -115,7 +115,7 @@ Two template variables are available for use in Usage, Description and ExtendedH -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -132,7 +132,7 @@ public class Program } } ``` -snippet source | anchor +snippet source | anchor help for Pop may have `Usage: git Stash Pop` @@ -156,7 +156,7 @@ Let's assume we have a program with a single command defined, called `Process`. -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); diff --git a/docs/Commands/subcommands.md b/docs/Commands/subcommands.md index f3366c30..09573897 100644 --- a/docs/Commands/subcommands.md +++ b/docs/Commands/subcommands.md @@ -10,7 +10,7 @@ Let's mimic the same behavior using CommandDotNet: -```c# +```cs [Command(Description = "Fake git application")] public class Program { @@ -52,7 +52,7 @@ public class Stash } } ``` -snippet source | anchor +snippet source | anchor Notice the `Stash` property decorated with the `[SubCommand]` attribute. @@ -133,7 +133,7 @@ The same git stash command could be modelled as a nested class. -```c# +```cs [Command(Description = "Fake git application")] public class Program { @@ -172,5 +172,5 @@ public class Program } } ``` -snippet source | anchor +snippet source | anchor diff --git a/docs/Diagnostics/command-logger.md b/docs/Diagnostics/command-logger.md index fb0c950b..b481d344 100644 --- a/docs/Diagnostics/command-logger.md +++ b/docs/Diagnostics/command-logger.md @@ -15,7 +15,7 @@ Given a program with default configuration -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -26,7 +26,7 @@ public class Program public void Add(IConsole console, int x, int y) => console.WriteLine(x + y); } ``` -snippet source | anchor +snippet source | anchor When the `[cmdlog]` directive is specified, the command logger middleware will output @@ -74,7 +74,7 @@ Here are the available parameters for configuration: -```c# +```cs /// Enable the command logger middleware /// The /// @@ -102,12 +102,12 @@ public static AppRunner UseCommandLogger(this AppRunner appRunner, -```c# +```cs .UseCommandLogger( excludeSystemInfo: true, includeMachineAndUser: true); ``` -snippet source | anchor +snippet source | anchor @@ -148,10 +148,10 @@ Additional information can be provided by setting the `additionalInfoCallback` p -```c# +```cs .UseCommandLogger(includeAppConfig: true); ``` -snippet source | anchor +snippet source | anchor @@ -274,7 +274,7 @@ Logs every command to logging framework. See [Enable via directive](#enable-via- -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -293,7 +293,7 @@ public class Program public class LogCommandAttribute : Attribute { } ``` -snippet source | anchor +snippet source | anchor Notice Add will always log for the command and Subtract never will. @@ -347,7 +347,7 @@ Allow user to enable as a [directive](../Extensibility/directives.md) -```c# +```cs return ctx.Tokens.TryGetDirective("cmdlog", out _) ? s => ctx.Console.Out.Write(s) : null; @@ -364,7 +364,7 @@ Add an intercepor method to your root command with a `--logcmd` option. This als -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -388,7 +388,7 @@ public class Program public void Subtract(IConsole console, int x, int y) => console.WriteLine(x - y); } ``` -snippet source | anchor +snippet source | anchor diff --git a/docs/Diagnostics/exceptions.md b/docs/Diagnostics/exceptions.md index b08b28b7..57099a12 100644 --- a/docs/Diagnostics/exceptions.md +++ b/docs/Diagnostics/exceptions.md @@ -13,7 +13,7 @@ CommandDotNet throws two types of exceptions -```c# +```cs static int Main(string[] args) { return new AppRunner() @@ -30,7 +30,7 @@ static int Main(string[] args) .Run(args); } ``` -snippet source | anchor +snippet source | anchor This delegate will be used for any errors thrown within `AppRunner.Run` or `AppRunner.RunAsync` @@ -49,7 +49,7 @@ Wrap the call to `appRunner.Run(args)` to handle global exceptions. -```c# +```cs static int Main(string[] args) { try @@ -66,7 +66,7 @@ static int Main(string[] args) } } ``` -snippet source | anchor +snippet source | anchor ## Exit Codes @@ -75,7 +75,7 @@ CommandDotnet has the following pre-defined exit codes -```c# +```cs public static class ExitCodes { public static Task Success => Task.FromResult(0); @@ -110,7 +110,7 @@ Here are the core parameters -```c# +```cs bool includeProperties = false, // print exception properties bool includeData = false, // print values from ex.Data dictionary bool includeStackTrace = false, // print stack trace @@ -141,7 +141,7 @@ Here's an example using all the features from above, which is likely overkill fo -```c# +```cs static int Main(string[] args) => AppRunner.Run(args); public static AppRunner AppRunner => @@ -182,7 +182,7 @@ public void Throw(string message) }; } ``` -snippet source | anchor +snippet source | anchor diff --git a/docs/GettingStarted/getting-started-100-calculator.md b/docs/GettingStarted/getting-started-100-calculator.md index 345bbb23..1763f9eb 100644 --- a/docs/GettingStarted/getting-started-100-calculator.md +++ b/docs/GettingStarted/getting-started-100-calculator.md @@ -7,7 +7,7 @@ Your first step is to create a console application. Begin by creating the commands: -```c# +```cs public class Program { // this is the entry point of your application diff --git a/docs/GettingStarted/getting-started-120-subcommands.md b/docs/GettingStarted/getting-started-120-subcommands.md index 0e6f9bab..c3876113 100644 --- a/docs/GettingStarted/getting-started-120-subcommands.md +++ b/docs/GettingStarted/getting-started-120-subcommands.md @@ -14,7 +14,7 @@ Let's enhance our calculator by adding additional Trigonometry operations and co -```c# +```cs public class Program { static int Main(string[] args) diff --git a/docs/GettingStarted/getting-started-140-default-commands.md b/docs/GettingStarted/getting-started-140-default-commands.md index 59c85a56..4882ae9b 100644 --- a/docs/GettingStarted/getting-started-140-default-commands.md +++ b/docs/GettingStarted/getting-started-140-default-commands.md @@ -12,7 +12,7 @@ CommandDotNet supports this with the `[DefaultCommand]` attribute used to decora -```c# +```cs public class Program { static int Main(string[] args) @@ -24,7 +24,7 @@ public class Program public void Execute(int x, int y) => Console.WriteLine(x + y); } ``` -snippet source | anchor +snippet source | anchor @@ -61,7 +61,7 @@ CommandDotNet does not force this pattern but can support it. Just create a clas -```c# +```cs public class Program { static int Main(string[] args) @@ -88,7 +88,7 @@ public class Subtract public void Execute(int x, int y) => Console.WriteLine(x - y); } ``` -snippet source | anchor +snippet source | anchor diff --git a/docs/GettingStarted/getting-started-300-help.md b/docs/GettingStarted/getting-started-300-help.md index a92718fd..27dea5bc 100644 --- a/docs/GettingStarted/getting-started-300-help.md +++ b/docs/GettingStarted/getting-started-300-help.md @@ -5,7 +5,7 @@ Let's make it more useful by adding descriptions, usage examples and extended he -```c# +```cs [Command( Description = "Performs mathematical calculations", ExtendedHelpTextLines = new [] diff --git a/docs/GettingStarted/getting-started-400-tests.md b/docs/GettingStarted/getting-started-400-tests.md index a2f1493a..3dc3d3ba 100644 --- a/docs/GettingStarted/getting-started-400-tests.md +++ b/docs/GettingStarted/getting-started-400-tests.md @@ -11,7 +11,7 @@ Let's extract the configuration into a public static property -```c# +```cs static int Main(string[] args) => AppRunner.Run(args); public static AppRunner AppRunner => new AppRunner(); @@ -25,7 +25,7 @@ The second step is to use `IConsole` to capture the output for assertions in tes -```c# +```cs public void Add(IConsole console, int x, int y) => console.WriteLine(x + y); public void Subtract(IConsole console, int x, int y) => console.WriteLine(x - y); @@ -39,7 +39,7 @@ Alternatively, or if there is code writing to System.Console that you cannot mig -```c# +```cs public static AppRunner AppRunner => new AppRunner() .InterceptSystemConsoleWrites(); @@ -55,7 +55,7 @@ CommandDotNet supports two different test patterns: -```c# +```cs [Test] public void Given2Numbers_Should_OutputSum() { @@ -73,7 +73,7 @@ BDD follows the Given / When / Then style. Configuration of the AppRunner is the -```c# +```cs [Test] public void Given2Numbers_Should_OutputSum() => Program.AppRunner.Verify(new Scenario diff --git a/docs/GettingStarted/getting-started-500-interceptors.md b/docs/GettingStarted/getting-started-500-interceptors.md index 869b5fa3..a857e47a 100644 --- a/docs/GettingStarted/getting-started-500-interceptors.md +++ b/docs/GettingStarted/getting-started-500-interceptors.md @@ -11,7 +11,7 @@ We'll use an example of a program used to query websites and may need basic auth -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -80,7 +80,7 @@ public class Curl } } ``` -snippet source | anchor +snippet source | anchor The interceptor method wraps the execution of the targetted command. diff --git a/docs/GettingStarted/getting-started-600-validation.md b/docs/GettingStarted/getting-started-600-validation.md index 30268d99..f08c1a34 100644 --- a/docs/GettingStarted/getting-started-600-validation.md +++ b/docs/GettingStarted/getting-started-600-validation.md @@ -6,7 +6,7 @@ Let's set the support for DataAnnotations and how you can use [Argument Models]( -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -54,7 +54,7 @@ public class Verbosity : IArgumentModel, IValidatableObject } } ``` -snippet source | anchor +snippet source | anchor There's a lot more going on here. so let's break it down. diff --git a/docs/GettingStarted/getting-started-700-pipes.md b/docs/GettingStarted/getting-started-700-pipes.md index 0e1ec114..35af19d3 100644 --- a/docs/GettingStarted/getting-started-700-pipes.md +++ b/docs/GettingStarted/getting-started-700-pipes.md @@ -2,7 +2,7 @@ -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -31,7 +31,7 @@ public class Program } } ``` -snippet source | anchor +snippet source | anchor Here we've converted the arguments for Sum into an IEnumerable and added a Range command. diff --git a/docs/GettingStarted/getting-started-800-ctrlc.md b/docs/GettingStarted/getting-started-800-ctrlc.md index af59514a..19532988 100644 --- a/docs/GettingStarted/getting-started-800-ctrlc.md +++ b/docs/GettingStarted/getting-started-800-ctrlc.md @@ -17,7 +17,7 @@ With console applications, the standard pattern is to exit the app when Ctrl+C i -```c# +```cs public class Program { static int Main(string[] args) => AppRunner.Run(args); @@ -46,7 +46,7 @@ public class Program } } ``` -snippet source | anchor +snippet source | anchor Again, CommandDotNet makes this very easy. Configure the app with `appRunner.UseCancellationHandlers()` which configures a `CancellationToken` that can be injected into your command and interceptor methods. diff --git a/docs/GettingStarted/getting-started-next-steps.md b/docs/GettingStarted/getting-started-next-steps.md index 9087b012..9dba8600 100644 --- a/docs/GettingStarted/getting-started-next-steps.md +++ b/docs/GettingStarted/getting-started-next-steps.md @@ -4,7 +4,7 @@ In the `Program.Main`, we configured the app with the basic feature set. -```c# +```cs new AppRunner() .UseDefaultMiddleware(); ``` diff --git a/docs/OtherFeatures/name-casing.md b/docs/OtherFeatures/name-casing.md index a775a77b..d5fa2a63 100644 --- a/docs/OtherFeatures/name-casing.md +++ b/docs/OtherFeatures/name-casing.md @@ -69,7 +69,7 @@ Example: [Humanizer middleare](https://github.com/bilal-fazlani/commanddotnet/bl -```c# +```cs /// Change the case of argument and command names to match the given cases /// /// The case to apply diff --git a/mkdocs.yml b/mkdocs.yml index aad6727a..19e35899 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -109,7 +109,7 @@ nav: theme: features: - navigation.tabs - - nagivation.instant + - navigation.instant - navigation.top - navigation.tracking - navigation.footer diff --git a/requirements.txt b/requirements.txt index 6c9d567d..aaf2b6c3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -mkdocs-material == 9.5.4 \ No newline at end of file +mkdocs-material == 9.5.48 \ No newline at end of file diff --git a/scripts/mkdocs-snippets.sh b/scripts/mkdocs-snippets.sh index 03768182..5ba9b33f 100644 --- a/scripts/mkdocs-snippets.sh +++ b/scripts/mkdocs-snippets.sh @@ -2,8 +2,5 @@ # install the tool first # dotnet tool install -g MarkdownSnippets.Tool -# extract snipptes from code and insert to docs -mdsnippets -c InPlaceOverwrite --url-prefix "https://github.com/bilal-fazlani/commanddotnet/blob/master" - -# mdsnippets uses ```cs for files and pygments expects ```c#, so fix the links -find ./docs/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -b -i 's/```cs/```c#/g' \ No newline at end of file +# extract snippets from code and insert to docs +mdsnippets -c InPlaceOverwrite --url-prefix "https://github.com/bilal-fazlani/commanddotnet/blob/master" \ No newline at end of file