From 01a4846159ff25af23959fd1ae57407e309f32e7 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Wed, 1 Feb 2023 12:32:21 +0200 Subject: [PATCH] Hyphenate "command-line" --- Changelog.md | 4 ++-- CliFx.Demo/Readme.md | 4 ++-- CliFx/Attributes/CommandOptionAttribute.cs | 8 +++---- CliFx/Attributes/CommandParameterAttribute.cs | 2 +- CliFx/CliApplication.cs | 8 +++---- CliFx/CliFx.csproj | 2 +- CliFx/Extensibility/BindingConverter.cs | 2 +- .../CommandInputConsoleFormatter.cs | 2 +- CliFx/ICommand.cs | 2 +- Readme.md | 24 +++++++++---------- 10 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Changelog.md b/Changelog.md index fd6c898..8d86582 100644 --- a/Changelog.md +++ b/Changelog.md @@ -100,7 +100,7 @@ - Assigned separate colors to parameters and options to make them visually stand out - Usage section no longer lists usage formats of all descendant commands - Command section now also lists available subcommands for each of the current command's subcommands -- Changed the behavior of `[preview]` directive. Running the application with this directive will now also print all resolved environment variables, in addition to parsed command line arguments. +- Changed the behavior of `[preview]` directive. Running the application with this directive will now also print all resolved environment variables, in addition to parsed command-line arguments. - Reworked `IArgumentValueConverter`/`ArgumentValueConverter` into `BindingConverter`. Method `ConvertFrom(...)` has been renamed to `Convert(...)`. - Reworked `ArgumentValueValidator` into `BindingValidator`. This class exposes an abstract `Validate(...)` method that returns a nullable `BindingValidationError`. This class also provides utility methods `Ok()` and `Error(...)` to help create corresponding validation results. - Changed the type of `IConsole.Output` and `IConsole.Error` from `StreamWriter` to `ConsoleWriter`. This type derives from `StreamWriter` and additionally exposes a `Console` property that refers to the console instance that owns the stream. This change enables you to author extension methods scoped specifically to console output and error streams. @@ -164,4 +164,4 @@ - Changed `IConsole` interface (and as a result, `SystemConsole` and `VirtualConsole`) to support writing binary data. Instead of `TextReader`/`TextWriter` instances, the streams are now exposed as `StreamReader`/`StreamWriter` which provide the `BaseStream` property that allows raw access. Existing usages inside commands should remain the same because `StreamReader`/`StreamWriter` are compatible with their base classes `TextReader`/`TextWriter`, but if you were using `VirtualConsole` in tests, you may have to update it to the new API. Refer to the readme for more info. - Changed argument binding behavior so that an error is produced if the user provides an argument that doesn't match with any parameter or option. This is done in order to improve user experience, as otherwise the user may make a typo without knowing that their input wasn't taken into account. -- Changed argument binding behavior so that options can be set to multiple argument values while specifying them with mixed naming. For example, `--option value1 -o value2 --option value3` would result in the option being set to corresponding three values, assuming `--option` and `-o` match with the same option. \ No newline at end of file +- Changed argument binding behavior so that options can be set to multiple argument values while specifying them with mixed naming. For example, `--option value1 -o value2 --option value3` would result in the option being set to corresponding three values, assuming `--option` and `-o` match with the same option. diff --git a/CliFx.Demo/Readme.md b/CliFx.Demo/Readme.md index 6241f7d..3c361fd 100644 --- a/CliFx.Demo/Readme.md +++ b/CliFx.Demo/Readme.md @@ -1,5 +1,5 @@ # CliFx Demo Project -Sample command line interface for managing a library of books. +Sample command-line interface for managing a library of books. -This demo project showcases basic CliFx functionality such as command routing, argument parsing, and autogenerated help text. \ No newline at end of file +This demo project showcases basic CliFx functionality such as command routing, argument parsing, and autogenerated help text. diff --git a/CliFx/Attributes/CommandOptionAttribute.cs b/CliFx/Attributes/CommandOptionAttribute.cs index 862bf91..3662cd1 100644 --- a/CliFx/Attributes/CommandOptionAttribute.cs +++ b/CliFx/Attributes/CommandOptionAttribute.cs @@ -40,7 +40,7 @@ public sealed class CommandOptionAttribute : Attribute /// /// Environment variable whose value will be used as a fallback if the option - /// has not been explicitly set through command line arguments. + /// has not been explicitly set through command-line arguments. /// public string? EnvironmentVariable { get; set; } @@ -51,7 +51,7 @@ public sealed class CommandOptionAttribute : Attribute public string? Description { get; set; } /// - /// Custom converter used for mapping the raw command line argument into + /// Custom converter used for mapping the raw command-line argument into /// a value expected by the underlying property. /// /// @@ -81,7 +81,7 @@ public sealed class CommandOptionAttribute : Attribute /// Initializes an instance of . /// public CommandOptionAttribute(string name, char shortName) - : this(name, (char?) shortName) + : this(name, (char?)shortName) { } @@ -97,7 +97,7 @@ public sealed class CommandOptionAttribute : Attribute /// Initializes an instance of . /// public CommandOptionAttribute(char shortName) - : this(null, (char?) shortName) + : this(null, (char?)shortName) { } } \ No newline at end of file diff --git a/CliFx/Attributes/CommandParameterAttribute.cs b/CliFx/Attributes/CommandParameterAttribute.cs index d47c4bb..331ccd0 100644 --- a/CliFx/Attributes/CommandParameterAttribute.cs +++ b/CliFx/Attributes/CommandParameterAttribute.cs @@ -47,7 +47,7 @@ public sealed class CommandParameterAttribute : Attribute public string? Description { get; set; } /// - /// Custom converter used for mapping the raw command line argument into + /// Custom converter used for mapping the raw command-line argument into /// a value expected by the underlying property. /// /// diff --git a/CliFx/CliApplication.cs b/CliFx/CliApplication.cs index a056616..58201f1 100644 --- a/CliFx/CliApplication.cs +++ b/CliFx/CliApplication.cs @@ -15,7 +15,7 @@ using CliFx.Utils.Extensions; namespace CliFx; /// -/// Command line application facade. +/// Command-line application facade. /// public class CliApplication { @@ -164,7 +164,7 @@ public class CliApplication } /// - /// Runs the application with the specified command line arguments and environment variables. + /// Runs the application with the specified command-line arguments and environment variables. /// Returns an exit code which indicates whether the application completed successfully. /// /// @@ -207,7 +207,7 @@ public class CliApplication } /// - /// Runs the application with the specified command line arguments. + /// Runs the application with the specified command-line arguments. /// Environment variables are resolved automatically. /// Returns an exit code which indicates whether the application completed successfully. /// @@ -228,7 +228,7 @@ public class CliApplication /// /// Runs the application. - /// Command line arguments and environment variables are resolved automatically. + /// Command-line arguments and environment variables are resolved automatically. /// Returns an exit code which indicates whether the application completed successfully. /// /// diff --git a/CliFx/CliFx.csproj b/CliFx/CliFx.csproj index f244ebb..8aa65ba 100644 --- a/CliFx/CliFx.csproj +++ b/CliFx/CliFx.csproj @@ -7,7 +7,7 @@ $(Company) - Declarative framework for building command line applications + Class-first framework for building command-line interfaces command line executable interface framework parser arguments cli app application net core https://github.com/Tyrrrz/CliFx https://github.com/Tyrrrz/CliFx/blob/master/Changelog.md diff --git a/CliFx/Extensibility/BindingConverter.cs b/CliFx/Extensibility/BindingConverter.cs index 48daad4..d09afb1 100644 --- a/CliFx/Extensibility/BindingConverter.cs +++ b/CliFx/Extensibility/BindingConverter.cs @@ -12,7 +12,7 @@ internal interface IBindingConverter public abstract class BindingConverter : IBindingConverter { /// - /// Parses value from a raw command line argument. + /// Parses value from a raw command-line argument. /// public abstract T Convert(string? rawValue); diff --git a/CliFx/Formatting/CommandInputConsoleFormatter.cs b/CliFx/Formatting/CommandInputConsoleFormatter.cs index d2fcd85..19077df 100644 --- a/CliFx/Formatting/CommandInputConsoleFormatter.cs +++ b/CliFx/Formatting/CommandInputConsoleFormatter.cs @@ -13,7 +13,7 @@ internal class CommandInputConsoleFormatter : ConsoleFormatter private void WriteCommandLineArguments(CommandInput commandInput) { - Write("Command line:"); + Write("Command-line:"); WriteLine(); WriteHorizontalMargin(); diff --git a/CliFx/ICommand.cs b/CliFx/ICommand.cs index 3d0d5be..feae3f2 100644 --- a/CliFx/ICommand.cs +++ b/CliFx/ICommand.cs @@ -4,7 +4,7 @@ using CliFx.Infrastructure; namespace CliFx; /// -/// Entry point through which the user interacts with the command line application. +/// Entry point through which the user interacts with the command-line application. /// public interface ICommand { diff --git a/Readme.md b/Readme.md index a81298b..feaaf1a 100644 --- a/Readme.md +++ b/Readme.md @@ -11,7 +11,7 @@ > 🟡 **Project status**: maintenance mode[[?]](https://github.com/Tyrrrz/.github/blob/master/docs/project-status.md) -**CliFx** is a simple to use, yet powerful framework for building command line applications. +**CliFx** is a simple to use, yet powerful framework for building command-line applications. Its primary goal is to completely take over the user input layer, allowing you to forget about infrastructural concerns and instead focus on writing your application. ## Terms of use[[?]](https://github.com/Tyrrrz/.github/blob/master/docs/why-so-political.md) @@ -51,7 +51,7 @@ To learn more about the war and how you can help, [click here](https://tyrrrz.me ### Application and commands -To turn your program into a command line interface, modify your `Main` method so that it delegates execution to `CliApplication`. +To turn your program into a command-line interface, modify your `Main` method so that it delegates execution to `CliApplication`. You can use `CliApplicationBuilder` to fluently create and configure an instance of `CliApplication`: ```csharp @@ -70,7 +70,7 @@ public static class Program > Exit code is used to communicate execution result to the parent process, so it's important that your program propagates it. > **Note**: -> When calling `CliApplication.RunAsync()`, **CliFx** resolves command line arguments and environment variables from `Environment.GetCommandLineArgs()` and `Environment.GetEnvironmentVariables()` respectively. +> When calling `CliApplication.RunAsync()`, **CliFx** resolves command-line arguments and environment variables from `Environment.GetCommandLineArgs()` and `Environment.GetEnvironmentVariables()` respectively. The code above uses `AddCommandsFromThisAssembly()` to detect command types defined within the current assembly. Commands are entry points, through which the user can interact with your application. @@ -129,7 +129,7 @@ v1.0 ### Parameters and options -Commands can be configured to take input from command line arguments. +Commands can be configured to take input from command-line arguments. To do that, you need to add properties to the command class and bind them using special attributes. In **CliFx**, there are two types of argument bindings: **parameters** and **options**. @@ -212,7 +212,7 @@ OPTIONS --version Shows version information. ``` -Overall, parameters and options are both used to consume input from the command line, but they differ in a few important ways: +Overall, parameters and options are both used to consume input from the command-line, but they differ in a few important ways: | | Parameter | Option | | ------------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- | @@ -226,7 +226,7 @@ Use options for all other non-required inputs, or when specifying the name expli ### Argument syntax -This library employs the POSIX argument syntax, which is used in most modern command line tools. +This library employs the POSIX argument syntax, which is used in most modern command-line tools. Here are some examples of how it works: - `myapp --foo bar` sets option `"foo"` to value `"bar"` @@ -246,7 +246,7 @@ The parser's context-free nature has several implications on how it consumes arg For example, `myapp -i file1.txt file2.txt` will always be parsed as an option with multiple values, regardless of the arity of the underlying property it's bound to. Similarly, unseparated arguments in the form of `myapp -ofile` will be treated as five distinct options `'o'`, `'f'`, `'i'`, `'l'`, `'e'`, instead of `'o'` being set to value `"file"`. -These rules also make the order of arguments important — command line string is expected to follow this pattern: +These rules also make the order of arguments important — command-line string is expected to follow this pattern: ```powershell > myapp [...directives] [command] [...parameters] [...options] @@ -379,7 +379,7 @@ public class SurfaceCalculatorCommand : ICommand ### Environment variables An option can be configured to use a specific environment variable as fallback. -If the user does not provide value for such option through command line arguments, the current value of the environment variable will be used instead. +If the user does not provide value for such option through command-line arguments, the current value of the environment variable will be used instead. ```csharp [Command] @@ -410,7 +410,7 @@ In such case, the value of the environment variable will be split by `Path.PathS ### Multiple commands -In order to facilitate a variety of different workflows, command line applications may provide the user with more than just a single command. +In order to facilitate a variety of different workflows, command-line applications may provide the user with more than just a single command. Complex applications may also nest commands underneath each other, employing a multi-level hierarchical structure. With **CliFx**, this is achieved by simply giving each command a unique name through the `[Command]` attribute. @@ -704,12 +704,12 @@ Attach debugger to PID 3148 to continue. ``` To run the application in preview mode, use the `[preview]` directive. -This will short-circuit the execution and instead print the consumed command line arguments as they were parsed, along with resolved environment variables: +This will short-circuit the execution and instead print the consumed command-line arguments as they were parsed, along with resolved environment variables: ```powershell > dotnet myapp.dll [preview] cmd arg1 arg2 -o foo --option bar1 bar2 -Command line: +Command-line: cmd [-o foo] [--option bar1 bar2] Environment: @@ -729,5 +729,5 @@ var app = new CliApplicationBuilder() ## Etymology -**CliFx** is made out of "Cli" for "Command Line Interface" and "Fx" for "Framework". +**CliFx** is made out of "Cli" for "Command-line Interface" and "Fx" for "Framework". It's pronounced as "cliff ex".