SharperHacks.CoreLibs.CommandLineInterface
0.6.0
Prefix Reserved
dotnet add package SharperHacks.CoreLibs.CommandLineInterface --version 0.6.0
NuGet\Install-Package SharperHacks.CoreLibs.CommandLineInterface -Version 0.6.0
<PackageReference Include="SharperHacks.CoreLibs.CommandLineInterface" Version="0.6.0" />
paket add SharperHacks.CoreLibs.CommandLineInterface --version 0.6.0
#r "nuget: SharperHacks.CoreLibs.CommandLineInterface, 0.6.0"
// Install SharperHacks.CoreLibs.CommandLineInterface as a Cake Addin #addin nuget:?package=SharperHacks.CoreLibs.CommandLineInterface&version=0.6.0 // Install SharperHacks.CoreLibs.CommandLineInterface as a Cake Tool #tool nuget:?package=SharperHacks.CoreLibs.CommandLineInterface&version=0.6.0
CommandLineParser
SharperHacks.CoreLibs.CommandLineParser
!!! This project is deprecated. !!!
There will be no further development.
Command line parser.
Licensed under the Apache License, Version 2.0. See LICENSE.
Contact: joseph@sharperhacks.org
Nuget: https://www.nuget.org/packages/SharperHacks.CoreLibs.CommandLineParser
Targets
- net8.0
- net9.0
Description
CommandLineParser generates an Arg KVP for every white-space delimited token on the command line or supplied by the caller.
- Splits each string, of the form
-key:value
or-key=value
, into{Name:key, Value:value}
pairs. - Tokens of the form
value
, possitional arguments, are mapped to{Name:#, Value:value}
pairs, if there is noContextDescriptor
matchingvalue
. - Support for verb or non-verb context names. Tokens of the form
registeredContextName
cause all further tokens to be mapped to that context, up to the next registered context name or occurance of two consecutive hyphens (--). - Supports parsing the command line or any supplied array of tokens (useful for interactive systems).
- Supports response files,
@filename.txt
will be processed as an EOL delimited array of argument tokens.- Supports nested response files.
- Supports mixed command line args plus one or more response files.
- Small footprint.
- Usage/help support.
It is intended for use in simple cases where argument string values are sufficient, or will only be used once, or as a base for more sophisticated options processing of the type needed for more complex applications. An Options & Verbs library that builds on this CommandLineProcessor is a current WIP.
Classes
Arg
The parser generates these from the argument strings using a simple rule set.
DescriptortDb
Tracks option contexts registered by verb and non-verb named contexts.
Args
Responsible for tracking KVP's, their context and rejecting unrecognized keys if matches are required.
CLIExceptions
Thrown when CommandLineParser or related component encounters an error.
CommandLineParser
A static class providing parsing methods. A static Args object parsed from the program command line arguments is the default, but overridable and overwritable behavior.
ContextDescriptor
Context descriptor defines valid verb and non-verb contexts. Allows the parser to distinguish between positional values, verbs and non-verb contexts.
HelpBuilder
Builds a help string from OptionDesccriptor values.
IRunnable
A Run() interface. All verbs must be IRunnable.
OptionBase<T>
Generic option base class.
OptionDescriptor
When used, allows the parser to detect/reject bad arguments.
OptionServices
A collection of static methods used by the various Option bits.
Option<T>
Encapsulates conversion from option string to T.
ResultAccumulator
A result type for IRunable.Run()
that allows for simple if x.Run()
expressions,
optional error messages and logically appending results to each other while preserving failures.
VerbBase
Abstract base class to implement verbs.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 is compatible. |
-
net8.0
- SharperHacks.CoreLibs.AppUtilities (>= 7.0.0)
- SharperHacks.CoreLibs.ExceptionsAndHandlers (>= 4.0.1)
- SharperHacks.CoreLibs.Interfaces (>= 0.4.0)
- SharperHacks.CoreLibs.JsonHelpers (>= 3.1.0)
- SharperHacks.CoreLibs.LogWrappers (>= 0.6.0)
- SharperHacks.CoreLibs.Reflection (>= 4.0.2)
- SharperHacks.CoreLibs.StringBuilderExtensions (>= 1.0.2)
- SharperHacks.CoreLibs.StringExtensions (>= 3.2.2)
- System.Text.Json (>= 9.0.0)
-
net9.0
- SharperHacks.CoreLibs.AppUtilities (>= 7.0.0)
- SharperHacks.CoreLibs.ExceptionsAndHandlers (>= 4.0.1)
- SharperHacks.CoreLibs.Interfaces (>= 0.4.0)
- SharperHacks.CoreLibs.JsonHelpers (>= 3.1.0)
- SharperHacks.CoreLibs.LogWrappers (>= 0.6.0)
- SharperHacks.CoreLibs.Reflection (>= 4.0.2)
- SharperHacks.CoreLibs.StringBuilderExtensions (>= 1.0.2)
- SharperHacks.CoreLibs.StringExtensions (>= 3.2.2)
- System.Text.Json (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.