Shuttle.Core.Cli
10.1.1
Prefix Reserved
dotnet add package Shuttle.Core.Cli --version 10.1.1
NuGet\Install-Package Shuttle.Core.Cli -Version 10.1.1
<PackageReference Include="Shuttle.Core.Cli" Version="10.1.1" />
paket add Shuttle.Core.Cli --version 10.1.1
#r "nuget: Shuttle.Core.Cli, 10.1.1"
// Install Shuttle.Core.Cli as a Cake Addin #addin nuget:?package=Shuttle.Core.Cli&version=10.1.1 // Install Shuttle.Core.Cli as a Cake Tool #tool nuget:?package=Shuttle.Core.Cli&version=10.1.1
Shuttle.Core.Cli
PM> Install-Package Shuttle.Core.Cli
Provides the Arguments
class that gives you access to command-line interface arguments:
Constructor
public Arguments(params string[] commandLine)
The commandLine
is parsed as arguments starting with -
, --
or /
followed by the argument name then either =
or :
and then the argument value.
The following are valid arguments:
-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 ("
).
An Arguments
instance may be constructed from the Environment.GetCommandLineArgs()
values using the Arguments.FromCommandLine()
static factory method.
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.
Argument definitions
You can add ArgumentDefinition
entries to an Arguments
instance by using the following method:
public Arguments Add(ArgumentDefinition definition)
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.
An argument definition may be marked as required by calling the AsRequired()
method which will set the IsRequired
property to true
. You can then call the HasMissingValues()
method on the Arguments
class which will return true
is there are any required arguments that have not been specified using either the proper name or an alias.
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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
- Shuttle.Core.Contract (>= 11.0.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Shuttle.Core.Cli:
Package | Downloads |
---|---|
Shuttle.Core.ServiceHost
Turns your console application into a Windows service. |
|
Shuttle.Core.WorkerService
Turns a console application into a Windows Service / Systemd Unit. |
GitHub repositories
This package is not used by any popular GitHub repositories.