Woof.CommandLine 5.0.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
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
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="Woof.CommandLine" Version="5.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Woof.CommandLine --version 5.0.1
#r "nuget: Woof.CommandLine, 5.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.
// 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .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 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

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.

Version Downloads Last updated
7.0.0 231 8/6/2023
6.2.0 625 2/20/2022
6.0.1 1,971 11/26/2021
6.0.0 686 11/9/2021
5.4.1 313 11/8/2021
5.4.0 893 10/14/2021
5.3.0 663 10/12/2021
5.2.1 335 8/20/2021
5.2.0 739 8/19/2021
5.1.1 441 8/18/2021
5.1.0 311 8/15/2021
5.0.1 292 3/29/2021
5.0.0 332 3/29/2021