mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Update readme
This commit is contained in:
@@ -34,7 +34,7 @@ To learn more about the war and how you can help, [click here](https://tyrrrz.me
|
|||||||
- Complete application framework, not just an argument parser
|
- Complete application framework, not just an argument parser
|
||||||
- Minimum boilerplate and easy to get started
|
- Minimum boilerplate and easy to get started
|
||||||
- Class-first configuration via attributes
|
- Class-first configuration via attributes
|
||||||
- Comprehensive autogenerated help text
|
- Comprehensive auto-generated help text
|
||||||
- Support for deeply nested command hierarchies
|
- Support for deeply nested command hierarchies
|
||||||
- Graceful cancellation via interrupt signals
|
- Graceful cancellation via interrupt signals
|
||||||
- Support for reading and writing binary data
|
- Support for reading and writing binary data
|
||||||
@@ -440,7 +440,7 @@ public class SubCommand : ICommand
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Once configured, the user can execute a specific command by prepending its name to the passed arguments.
|
Once configured, the user can execute a specific command by pre-pending its name to the passed arguments.
|
||||||
For example, running `dotnet myapp.dll cmd1 arg1 -p 42` will execute `FirstCommand` in the above example.
|
For example, running `dotnet myapp.dll cmd1 arg1 -p 42` will execute `FirstCommand` in the above example.
|
||||||
|
|
||||||
Requesting help will show direct subcommands of the current command:
|
Requesting help will show direct subcommands of the current command:
|
||||||
@@ -528,7 +528,7 @@ Division by zero is not supported.
|
|||||||
133
|
133
|
||||||
```
|
```
|
||||||
|
|
||||||
> ⚠️ Even though exit codes are represented by 32-bit integers in .NET, using values outside of 8-bit unsigned range will cause an overflow on Unix systems.
|
> ⚠️ Even though exit codes are represented by 32-bit integers in .NET, using values outside 8-bit unsigned range will cause an overflow on Unix systems.
|
||||||
> To avoid unexpected results, use numbers between 1 and 255 for exit codes that indicate failure.
|
> To avoid unexpected results, use numbers between 1 and 255 for exit codes that indicate failure.
|
||||||
|
|
||||||
### Graceful cancellation
|
### Graceful cancellation
|
||||||
@@ -569,7 +569,7 @@ public class CancellableCommand : ICommand
|
|||||||
Because **CliFx** takes responsibility for the application's entire lifecycle, it needs to be capable of instantiating various user-defined types at runtime.
|
Because **CliFx** takes responsibility for the application's entire lifecycle, it needs to be capable of instantiating various user-defined types at runtime.
|
||||||
To facilitate that, it uses an interface called `ITypeActivator` that determines how to create a new instance of a given type.
|
To facilitate that, it uses an interface called `ITypeActivator` that determines how to create a new instance of a given type.
|
||||||
|
|
||||||
The default implementation of `ITypeActivator` only supports types that have public parameterless constructors, which is sufficient for majority of scenarios.
|
The default implementation of `ITypeActivator` only supports types that have public parameterless constructors, which is sufficient for the majority of scenarios.
|
||||||
However, in some cases you may also want to define a custom initializer, for example when integrating with an external dependency container.
|
However, in some cases you may also want to define a custom initializer, for example when integrating with an external dependency container.
|
||||||
|
|
||||||
The following example shows how to configure your application to use [`Microsoft.Extensions.DependencyInjection`](https://nuget.org/packages/Microsoft.Extensions.DependencyInjection) as the type activator in **CliFx**:
|
The following example shows how to configure your application to use [`Microsoft.Extensions.DependencyInjection`](https://nuget.org/packages/Microsoft.Extensions.DependencyInjection) as the type activator in **CliFx**:
|
||||||
|
|||||||
Reference in New Issue
Block a user