VOOZH about

URL: https://www.nuget.org/packages/deniszykov.CommandLine.Hosted/

⇱ NuGet Gallery | deniszykov.CommandLine.Hosted 2.1.11




deniszykov.CommandLine.Hosted 2.1.11

dotnet add package deniszykov.CommandLine.Hosted --version 2.1.11
 
 
NuGet\Install-Package deniszykov.CommandLine.Hosted -Version 2.1.11
 
 
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="deniszykov.CommandLine.Hosted" Version="2.1.11" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="deniszykov.CommandLine.Hosted" Version="2.1.11" />
 
Directory.Packages.props
<PackageReference Include="deniszykov.CommandLine.Hosted" />
 
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 deniszykov.CommandLine.Hosted --version 2.1.11
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: deniszykov.CommandLine.Hosted, 2.1.11"
 
 
#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 deniszykov.CommandLine.Hosted@2.1.11
 
 
#: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=deniszykov.CommandLine.Hosted&version=2.1.11
 
Install as a Cake Addin
#tool nuget:?package=deniszykov.CommandLine.Hosted&version=2.1.11
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

👁 dotnet_build

Introduction

A simple getopt styled command line library.

Installation

Install-Package deniszykov.CommandLine

For .NET Core Hosted environment:

Install-Package deniszykov.CommandLine.Hosted

Quick Start

To start, you need to configure the entry point to the application:

public class Program
{

 private static int Main(string[] arguments) =>
 CommandLine
 .CreateFromArguments(arguments)
 .Use<Program>() // set class with verbs/commands
 .Run();

 //
 // Usage: myapp.exe hello --name <name>
 // 
 public static int Hello(string name)
 // ^ ^
 // Verb Option
 {
 Console.WriteLine("Hello " + name + "!");
 return 0; // exit code
 } 

}

/

CommandLine relies on reflection to find method to invoke.
This method should return int value which is interpreted as Exit Code of application.
Asynchronous entry points and methods are also supported. To do this, use method RunAsync() and Task<int> as return type.

When you could request help for your application:

> myapp /?

This test application. Type /? for help.

 Verbs:
 HELLO Says hello to specified 'name'.

Or invoke Hello(string name) with following command:

> myapp hello --name Jake

Hello Jake!

Documentation

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 is compatible. 
.NET Standard netstandard2.1 netstandard2.1 is compatible. 
.NET Framework net461 net461 is compatible.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos 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
2.1.11 2,287 4/29/2025
2.1.10 622 6/25/2024
2.1.8 760 10/5/2023
2.1.7 721 4/13/2023
2.0.6 788 10/7/2022
2.0.5 870 7/24/2022
2.0.4 857 4/6/2022
2.0.0 854 3/5/2021

# 2.1.10
- updated dependencies
- feature: added `CommandLineConfiguration.AllowPrefixesInOptionValues` which allow to have `--unknown-options` after known ones. If set to true then such `--unknown-options` will be captured as values of known option.
# 2.1.8
- updated dependencies
- feature: added alternative ExceptionEventHandler registration via `services.AddTransient<ExceptionEventHandler>()`
# 2.1.7
- added option to display title text for sub-verbs
- fixed help text generation for sub-verbs
# 2.0.2 - 2.0.6
- added posibility to use multiple c# classes as combined source of verbs
- updated dependencies
# 2.0.1
- updated target frameworks for 'Hosted' version of package to include .NET Framework 4.6.1
# 2.0.0
- rewritten as a service
- commands, Parameters are now Verbs, Options, Values
- now follows getOpt syntax
- services could be injected in parameters
- verbs are now could be async and cancelled
- configuration is now in separate class
- help request is build-in and doesn't require custom 'Help' command
- console has been abstracted and could be replaced
- help text is now localizable
- fixed bugs with help text and sub-verbs
# 1.3.1 - 1.3.2
- TypeConvert dependecy update (bug fixes)
# 1.3.0
- added TypeConverterAttribute support on command parameters. It's takes precendence before any other types of type conversions.
# 1.2.9
- added netcoreapp2.1 target platform
- dependencies update (internal)
# 1.2.7
- fixed exception when calling Describe while console output is redirected
- TypeConvert package update
# 1.2.6
- TypeConvert package update
- documentation update
# 1.2.5
- added WriteWholeErrorMessageOnBindFailure option for debugging purpose (it writes descriptive error message to stderr stream)
- added DescribeExitCode option for controlling exit code of Describe method
- tuned error messages when no command is specified or wrong parameters are passed
- tuned Describe method for better description text (friendly type names, nullable types support etc...)
# 1.2.4
- fixed binding error when no default action is specified
- added XML documentation file to package
# 1.2.3
- updated references for .NET Core Targets and .NET Standard
# 1.2.2
- returned original library name ConsoleApp.CommandLine.dll
# 1.2.1
- embedded TypeConvert dependency
# 1.2.0
- CommandLine.UnhandledException type changed to ExceptionEventHandler
- added custom description attributes as replacement to System.ComponentModel attributes: HelpTextAttribute and HiddenAttribute
- added support of .NET Standard platform
# 1.1.3
- refactored error messages fo parameters binding failure cases.
- added CommandLineException to signal binding failures.
- fixed few array parameter binding bugs
# 1.1.2
- added bare double hyphen to enforce positional parameters
- added bare single hyphen to disable hyphen interpretation in values
- added special treatment for negative numbers
- added CommandLine.DescribeOnBindFailure which controls reaction on method binding failure (true to run CommandLine.Describe(), false to throw exception).
- added enum flags binding subroutine, now "--flag Flag1 Flag2 Flag3" arguments are supported.
- changed method binding order to from most parameters to less (original was chaotic), binding strategy is still - "first match".
- added non-generic Run and Describe methods
- fixed bug with positional parameters binding
# 1.0.0
- initial release