Woof.CommandLine
5.0.1
Prefix Reserved
See the version list below for details.
dotnet add package Woof.CommandLine --version 5.0.1
NuGet\Install-Package Woof.CommandLine -Version 5.0.1
<PackageReference Include="Woof.CommandLine" Version="5.0.1" />
paket add Woof.CommandLine --version 5.0.1
#r "nuget: Woof.CommandLine, 5.0.1"
// Install Woof.CommandLine as a Cake Addin #addin nuget:?package=Woof.CommandLine&version=5.0.1 // Install Woof.CommandLine as a Cake Tool #tool nuget:?package=Woof.CommandLine&version=5.0.1
Woof.CommandLine
.NET extension created by CodeDog
Distributed under MIT License. (c)2021 by CodeDog Ltd., All rights reserved.
About
Quick command line parser. Parses command line arguments into parameters and options. An option is an argument starting with a prefix. A parameter is an argument that is not an option. The parameters can be accessed by their positional index. Considering following command line:
text.exe p1 -o1 p2 p3
When we parse the command line to a CommandLine
instance c
,
we can access "p1", "p2" and "p3" strings as c.Parameters[0]
,
c.Parameters[1]
and c.Parameters[2]
.
We can also safely test for c.Parameters[3]
-
it would be just null
.
When we want to test whether the command line contains
an option "o1" (that can be also written as "--o1" or "/o1"),
that is an alias for name "option1", we can do all that with one
simple function: var result = c.HasOption("o1|option1")
.
Any option can also have value assigned to it with "=" character.
Example:
test.exe -path="C:\Program Files"
In that case, c.Options["path"]
would return "C:\Program Files".
Spaces quoting is handled by the system itself. So anything provided with quotes in command line will be passed as unquoted arguments containing spaces. So for the example command line above, the arguments will be just 1 string: "path=c:\Program Files" (without quotes).
Usage
See unit tests for more examples.
Disclaimer
Please report any issues to the toolkit developer.
Woof Toolkit is a work in progress in constant development, however it's carefully maintained with production code quality.
I changed toolkit versioning to 5.x to match the primary .NET 5.0 targetting.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. 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 was computed. |
.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. |
-
.NETStandard 2.0
- No dependencies.
-
net5.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Woof.CommandLine:
Package | Downloads |
---|---|
Woof.ServiceInstaller
Registers and unregisters a project executable as either Windows Service or systemd deamon. Works both on Windows and Linux. |
GitHub repositories
This package is not used by any popular GitHub repositories.