You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,7 +100,7 @@ public partial class LogCommand : ICommand
100
100
> The command type must be declared as `partial` so that **CliFx** can extend it with necessary metadata and behavior.
101
101
> If the type is nested within other types, all of them must also be marked as `partial`.
102
102
103
-
In order to satisfy `ICommand`'s contract, the type needs to define an `ExecuteAsync(...)` method which contains the command's execution logic.
103
+
The `ICommand` interface requires the type to define an `ExecuteAsync(...)` method, which contains the command's execution logic.
104
104
As the only parameter, this method takes an instance of `IConsole` — a decoupled abstraction used in place of `System.Console` to write text, read binary data, or otherwise interact with the console.
105
105
106
106
Beyond that, your command will probably also need to receive some input from the user.
@@ -146,7 +146,7 @@ public static class Program
146
146
> When calling `CommandLineApplication.RunAsync()`, **CliFx** resolves command-line arguments and environment variables from `Environment.GetCommandLineArgs()` and `Environment.GetEnvironmentVariables()` respectively.
147
147
> You can also provide them explicitly using one of the other available overloads.
148
148
149
-
In order to make the command available for execution, it needs to be registered with the application.
149
+
For the command to be available for execution, it needs to be registered with the application.
150
150
The above example relies on `AddCommandsFromThisAssembly()` for that, which automatically detects and registers all accessible commands from the current assembly.
151
151
152
152
Now, the user can execute `LogCommand` by running the application and passing an argument to the `value` parameter:
@@ -454,7 +454,7 @@ As a general guideline, prefer using option bindings for inputs that:
454
454
455
455
#### Conversion
456
456
457
-
In order to handle input conversion between raw command-line arguments (strings) and the underlying properties, **CliFx** employs the `IInputConverter<T>` interface.
457
+
**CliFx** employs the `IInputConverter<T>` interface to handle input conversion between raw command-line arguments (strings) and the underlying properties.
458
458
By default, the framework will try to automatically infer a suitable converter for each property based on its type, supporting the following scenarios:
459
459
460
460
-`string`
@@ -752,7 +752,7 @@ public static class Program
752
752
753
753
### Command routing
754
754
755
-
In order to facilitate a variety of different workflows, command-line applications may provide the user with more than just a single command.
755
+
Command-line applications often provide the user with more than just a single command, facilitating a variety of different workflows.
756
756
Complex applications may also nest commands within each other, employing a multi-level hierarchical structure.
757
757
758
758
With **CliFx**, this is achieved by simply giving each command a unique name through the `[Command]` attribute.
@@ -889,7 +889,7 @@ $ echo $?
889
889
Console applications support the concept of interrupt signals, which can be issued by the user to abort the currently ongoing operation.
890
890
If your command performs critical work, you can intercept these signals to handle cancellation requests in a graceful way.
891
891
892
-
In order to make the command cancellation-aware, call `console.RegisterCancellationHandler()` to register the signal handler and obtain the corresponding `CancellationToken`.
892
+
You can make a command cancellation-aware by calling `console.RegisterCancellationHandler()`, which registers the signal handler and returns the corresponding `CancellationToken`.
893
893
Once this method is called, the program will no longer terminate on an interrupt signal but will instead trigger the associated token, which can be used to delay the termination of a command enough to exit in a controlled manner:
0 commit comments