MiniCommandLineParser 1.0.0.1
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.1
This package targets .NET Standard 2.1. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package MiniCommandLineParser --version 1.0.0.1
NuGet\Install-Package MiniCommandLineParser -Version 1.0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MiniCommandLineParser" Version="1.0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MiniCommandLineParser" Version="1.0.0.1" />
<PackageReference Include="MiniCommandLineParser" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MiniCommandLineParser --version 1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MiniCommandLineParser, 1.0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MiniCommandLineParser@1.0.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MiniCommandLineParser&version=1.0.0.1
#tool nuget:?package=MiniCommandLineParser&version=1.0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MiniCommandLineParser
A simple, lightweight, and dependency-free command-line parsing library for .NET.
âĻ Features
- ðŠķ Lightweight - Minimal footprint, no external dependencies
- ðŊ Simple API - Intuitive attribute-based configuration
- ðĶ Multi-target - Supports .NET 6/7/8/9 and .NET Standard 2.1
- ð Bidirectional - Parse arguments to objects AND format objects back to command-line strings
- ð Auto Help Text - Built-in help text generation
- ð§ Flexible - Supports short/long options, arrays, enums, flags, and more
ðĨ Installation
dotnet add package MiniCommandLineParser
ð Quick Start
1. Define Your Options Class
using MiniCommandLineParser;
public class Options
{
[Option('i', "input", Required = true, HelpText = "Input file path")]
public string InputFile { get; set; }
[Option('o', "output", HelpText = "Output file path")]
public string OutputFile { get; set; }
[Option('v', "verbose", HelpText = "Enable verbose output")]
public bool Verbose { get; set; }
[Option("count", HelpText = "Number of iterations")]
public int Count { get; set; } = 1;
[Option("tags", HelpText = "List of tags")]
public List<string> Tags { get; set; }
}
2. Parse Command-Line Arguments
var result = Parser.Default.Parse<Options>(args);
if (result.Result == ParserResultType.Parsed)
{
var options = result.Value;
Console.WriteLine($"Input: {options.InputFile}");
}
else
{
Console.WriteLine(result.ErrorMessage);
}
ð Supported Argument Formats
# Short options
-v -i input.txt
# Long options
--verbose --input input.txt
# Equals syntax
--input=input.txt
# Quoted values (with spaces)
--output "my output file.txt"
# Array values
--tags tag1 tag2 tag3
# Flags enum
--flags Flag1 Flag2 Flag3
ð Format Object to Command Line
var options = new Options { InputFile = "test.txt", Verbose = true };
// Full output (all options)
string cmdLine = Parser.FormatCommandLine(options, CommandLineFormatMethod.Complete);
// Output: --input test.txt --verbose True --count 1
// Simplified output (only non-default values)
string simplified = Parser.FormatCommandLine(options, CommandLineFormatMethod.Simplify);
// Output: --input test.txt --verbose True
ð Auto-Generate Help Text
var helpText = Parser.GetHelpText(new Options());
Console.WriteLine(helpText);
âïļ Parser Settings
var parser = new Parser(new ParserSettings
{
CaseSensitive = false, // Case-insensitive matching (default)
IgnoreUnknownArguments = true // Ignore unknown arguments (default)
});
ð License
MIT License - see GitHub Repository for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- 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.