Shuttle.Cli 21.0.1

Prefix Reserved
dotnet add package Shuttle.Cli --version 21.0.1
                    
NuGet\Install-Package Shuttle.Cli -Version 21.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="Shuttle.Cli" Version="21.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shuttle.Cli" Version="21.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Shuttle.Cli" />
                    
Project file
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 Shuttle.Cli --version 21.0.1
                    
#r "nuget: Shuttle.Cli, 21.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 Shuttle.Cli@21.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=Shuttle.Cli&version=21.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Shuttle.Cli&version=21.0.1
                    
Install as a Cake Tool

Shuttle.Cli

Provides the Arguments class that gives you access to command-line interface arguments:

Installation

dotnet add package Shuttle.Cli

Constructor

public Arguments(params string[] commandLine)

The commandLine is parsed as arguments starting with -, -- or / followed by the argument name then either =, :, or a space, and then the argument value.

The following are valid arguments:

-name=value
--name=value
/name=value
-name:value
--name:value
/name:value
-name value
--name value
/name value

The argument name and value may be quoted with either a single quote (') or double quote (").

Boolean Flags

You may also pass boolean flags without a value to automatically assign them the value "true":

-flag
--flag
/flag

Static Factory Method

public static Arguments FromCommandLine()

Creates an Arguments instance from the current process command line, automatically skipping the executable name:

var args = Arguments.FromCommandLine();

Properties

public string[] CommandLine { get; }
public IEnumerable<ArgumentDefinition> Definitions { get; }
public string? this[string name] { get; }
  • CommandLine: Returns the original command line arguments
  • Definitions: Returns read-only collection of argument definitions
  • this[string name]: Indexer to get argument value by name

Checking for values

public bool Contains(string name)

Returns true if the given argument name is found; else false.

Getting values

public T Get<T>(string name)
public T Get<T>(string name, T @default)

Returns the value of the given argument name as type T. If the argument name cannot be found the value given as @default will be returned. If not @default is specified an InvalidOperationException is thrown.

Adding arguments programmatically

public Arguments Add(string key)
public Arguments Add(string key, string value)

Add arguments programmatically to the collection:

args.Add("verbose");
args.Add("output", "results.txt");

Argument definitions

You can add ArgumentDefinition entries to an Arguments instance by using the following method:

public Arguments Add(ArgumentDefinition definition)
ArgumentDefinition constructor
public ArgumentDefinition(string name, params string[] aliases)

Creates a new argument definition with optional aliases:

var definition = new ArgumentDefinition("input", "i", "in");
ArgumentDefinition fluent methods
public ArgumentDefinition WithDescription(string description)
public ArgumentDefinition AsRequired()

Configure argument definitions using fluent interface:

var definition = new ArgumentDefinition("input", "i")
    .WithDescription("Input file path")
    .AsRequired();

Argument definitions must have unique keys and if aliases are used these too have to be unique across definitions. Duplicate aliases within the same argument definition will be ignored.

Help text generation

public string GetDefinitionText(int consoleWidth = 80, bool required = false, string prefix = "  ")

Generates formatted help text for defined arguments:

var helpText = args.GetDefinitionText();
Console.WriteLine(helpText);

To show only required arguments:

var requiredHelp = args.GetDefinitionText(required: true);

Validation

public bool HasMissingValues()

Returns true if there are any required arguments that have not been specified using either the proper name or an alias:

if (args.HasMissingValues())
{
    Console.WriteLine("Missing required arguments:");
    Console.WriteLine(args.GetDefinitionText(required: true));
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
21.0.1 104 4/15/2026
21.0.1-rc3 95 4/11/2026