SharpCLI 1.5.7
dotnet add package SharpCLI --version 1.5.7
NuGet\Install-Package SharpCLI -Version 1.5.7
<PackageReference Include="SharpCLI" Version="1.5.7" />
<PackageVersion Include="SharpCLI" Version="1.5.7" />
<PackageReference Include="SharpCLI" />
paket add SharpCLI --version 1.5.7
#r "nuget: SharpCLI, 1.5.7"
#:package SharpCLI@1.5.7
#addin nuget:?package=SharpCLI&version=1.5.7
#tool nuget:?package=SharpCLI&version=1.5.7
SharpCLI
![]()
A modern, attribute-based CLI framework for .NET
Transform your methods into powerful CLI commands using simple attributes with automatic arguments parsing, help generation, and async support.
Acknowledgments
SharpCLI's design and architecture are derived from the foundational concepts established by Python Click, developed by the Pallets team.
Features
- Method-Based Commands - Turn any method into a CLI command with a simple attribute
- Attribute-Driven - Use
[Command],[Argument], and[Option]attributes to define your CLI - Automatic Parsing - Built-in argument parsing with type conversion and validation
- Auto-Generated Help - Beautiful help text generated from your attributes
- Async Support - Full support for async commands with
Task - Command Aliases - Multiple ways to invoke the same command
- Type Safety - Strongly-typed parameters with compile-time checking
- Zero Dependencies - Lightweight with no external dependencies
Code Quality
Installation
dotnet add package SharpCli
Quick Start
1. Define Your Commands, Register and Run
// For static methods
var app = new SharpCliHost("cli-app", "An awesome CLI application")
.RegisterCommands<StaticCommands>();
return await app.RunAsync(args);
public class StaticCommands : ICommandsContainer
{
[Command("hello-world", Description = "Hello World!")]
public static int HelloWorld()
{
Console.WriteLine("SharpCLI is awesome!");
return 0;
}
}
// Or
// For non-static methods
var app = new SharpCliHost("cli-app", "An awesome CLI application")
.RegisterCommands(new NonStaticCommands());
return await app.RunAsync(args);
public class NonStaticCommands : ICommandsContainer
{
[Command("greet", Description = "Greet someone", Aliases = ["hello", "hi"])]
public int Greet(
[Argument("name", Description = "Person to greet")] string name,
[Option("m", "message", Description = "Custom message")] string message = "Hello",
[Option("c", "count", Description = "Times to greet")] int count = 1)
{
for (int i = 0; i < count; i++)
{
Console.WriteLine($"{message}, {name}!");
}
return 0;
}
}
2. Use Your CLI
# Basic usage
cli-app hello-world
# Usage with arguments and options
cli-app greet Bob -m "Hi there" --count 3
# Usage of help
cli-app --help
cli-app greet --help
Builder Options
The SharpCliHostBuilder provides a clean, fluent way to configure your application:
var app = new SharpCliHost()
.CreateBuilder()
.Name("myapp") // Required: App name used in help/usage
.Description("My awesome CLI tool") // Optional: Shown in main help header
.Writer(new StringWriter()) // Optional: Custom output (great for testing)
.CustomHelpMessage("Custom welcome text\nLine two...") // Optional: Top of main help
.Build();
Advanced Features
Async Commands
[Command("download")]
public async Task<int> Download(
[Argument("url")] string url,
[Option("o", "output")] string output = "download")
{
// Async implementation
await DownloadFileAsync(url, output);
return 0;
}
License
This project is licensed under the MIT License - see the MIT License file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.5.7 | 106 | 1/22/2026 |
| 1.5.6 | 103 | 1/19/2026 |
| 1.5.5 | 107 | 1/15/2026 |
| 1.5.4 | 102 | 1/12/2026 |
| 1.5.3 | 111 | 1/7/2026 |
| 1.5.2 | 101 | 1/6/2026 |
| 1.5.1 | 105 | 1/6/2026 |
| 1.5.0 | 102 | 1/6/2026 |
| 1.4.10 | 101 | 12/30/2025 |
| 1.4.9 | 104 | 12/30/2025 |
| 1.4.8 | 97 | 12/30/2025 |
| 1.4.6 | 187 | 8/19/2025 |
| 1.3.5 | 581 | 7/22/2025 |
| 1.3.4 | 180 | 7/10/2025 |
| 1.3.3 | 181 | 7/10/2025 |
| 1.3.2 | 181 | 7/10/2025 |
| 1.3.1 | 172 | 7/10/2025 |
| 1.2.1 | 182 | 7/10/2025 |
| 1.1.1 | 186 | 7/10/2025 |
| 1.0.1 | 176 | 7/9/2025 |