Woof.CommandLine 7.0.0

Prefix Reserved
dotnet add package Woof.CommandLine --version 7.0.0                
NuGet\Install-Package Woof.CommandLine -Version 7.0.0                
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="7.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Woof.CommandLine --version 7.0.0                
#r "nuget: Woof.CommandLine, 7.0.0"                
#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=7.0.0

// Install Woof.CommandLine as a Cake Tool
#tool nuget:?package=Woof.CommandLine&version=7.0.0                

Woof.CommandLine

A part of the Woof Tookit by CodeDog.

Distributed under MIT License. (c)2022 by CodeDog, All rights reserved.


About

Advanced command line parser using POSIX, PowerShell and DOS command line arguments formatting guidelines. Automatically generates console documentation from options and assembly metadata.

It replaces all previous versions of the package and it's completely incompatible with them. Please analyse the test project sources carefuly to understand how it works. The current module is much more advanced, modern and complete.

Key features

The command line module is accessible application wide via static class CommandLine. There's no need to pass the module as service via DI. It is because command line arguments are given once, on the application start and will not change.

If for some reasons parsing of various separate command lines is needed, the CommandLineParser instance can be used for that.

The command line arguments are divided into options and parameters. The option is an argument that starts with a prefix defined for specified syntax. The option can have a value either defined in the next parametr, or in the same parameter after setter separator (default ':' or '='). The options in POSIX syntax can be also grouped, so "-abc" is equivalent to "-a -b -c", and "-ab=1" is equivalent to "-a -b 1".

The options recognized by parser are defined with configured enumerations. Each configured option should be decorated with Option attribute. The attribute defines the option aliases (names recognized), value placeholder text and the optional description. The option attribute can also have Required property used for validation.

The option enumerations are mapped to the parser with the Map<TEnum>() method. Multiple enumerations can be mapped to the same parser.

Validation of the arguments given against the options enumeration can produce detailed error messages. To get separate validation error messages get the ValidationErrors property of the CommandLineParser instance. To get validation errors from the default instance as a single block of text use the ValidationErrors property of the CommandLine static class.

Defined optons can be also mapped to delegates, and the delegates will be run when matched with RunDelegates() or RunDelegatesAsync() method. The delegates can be either synchronous or asynchronous and can accept the option value if applicable. The delegates can accept string, int and double types. The values will be parsed using InvariantCulture.

The CommandLine class also provide automatic documentation created from options enumeration and assembly metadata. The full automatic documentation is available in CommandLine.Help property.

Usage

For basic and advanced usage examples check the test modules sources included in the GitHub project. Also refer to the XML documentation.


Disclaimer

Woof Toolkit is a work in progress in constant development, however it's carefully maintained with production code quality.

PLEASE report all issues on GitHub!

Describe how to reproduce an issue. Also feel free to suggest new features or improvements.

Product Compatible and additional computed target framework versions.
.NET 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.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.

Version Downloads Last updated
7.0.0 285 8/6/2023
6.2.0 676 2/20/2022
6.0.1 2,026 11/26/2021
6.0.0 741 11/9/2021
5.4.1 351 11/8/2021
5.4.0 964 10/14/2021
5.3.0 724 10/12/2021
5.2.1 369 8/20/2021
5.2.0 797 8/19/2021
5.1.1 503 8/18/2021
5.1.0 346 8/15/2021
5.0.1 327 3/29/2021
5.0.0 371 3/29/2021

.NET7 target.