SharperHacks.CoreLibs.CommandLineInterface
0.1.0
Prefix Reserved
See the version list below for details.
dotnet add package SharperHacks.CoreLibs.CommandLineInterface --version 0.1.0
NuGet\Install-Package SharperHacks.CoreLibs.CommandLineInterface -Version 0.1.0
<PackageReference Include="SharperHacks.CoreLibs.CommandLineInterface" Version="0.1.0" />
<PackageVersion Include="SharperHacks.CoreLibs.CommandLineInterface" Version="0.1.0" />
<PackageReference Include="SharperHacks.CoreLibs.CommandLineInterface" />
paket add SharperHacks.CoreLibs.CommandLineInterface --version 0.1.0
#r "nuget: SharperHacks.CoreLibs.CommandLineInterface, 0.1.0"
#:package SharperHacks.CoreLibs.CommandLineInterface@0.1.0
#addin nuget:?package=SharperHacks.CoreLibs.CommandLineInterface&version=0.1.0
#tool nuget:?package=SharperHacks.CoreLibs.CommandLineInterface&version=0.1.0
CommandLineParser
SharperHacks.CoreLibs.CommandLineParser
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:valueor-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 noContextDescriptormatchingvalue. - Support for verb or non-verb context names. Tokens of the form
registeredContextNamecause 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.txtwill 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.
ArgContextDb
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.
RunableResult
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.
| 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. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- SharperHacks.CoreLibs.AppUtilities (>= 5.1.0)
- SharperHacks.CoreLibs.Constants (>= 4.0.0)
- SharperHacks.CoreLibs.Constraints (>= 4.0.0)
- SharperHacks.CoreLibs.JsonHelpers (>= 3.0.0)
- SharperHacks.CoreLibs.Reflection (>= 4.0.0)
- SharperHacks.CoreLibs.StringBuilderExtensions (>= 1.0.0)
- SharperHacks.CoreLibs.StringExtensions (>= 3.0.0)
-
net9.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- SharperHacks.CoreLibs.AppUtilities (>= 5.1.0)
- SharperHacks.CoreLibs.Constants (>= 4.0.0)
- SharperHacks.CoreLibs.Constraints (>= 4.0.0)
- SharperHacks.CoreLibs.JsonHelpers (>= 3.0.0)
- SharperHacks.CoreLibs.Reflection (>= 4.0.0)
- SharperHacks.CoreLibs.StringBuilderExtensions (>= 1.0.0)
- SharperHacks.CoreLibs.StringExtensions (>= 3.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.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.18.3 | 78 | 11/11/2025 |
| 0.18.2 | 56 | 11/11/2025 |
| 0.18.1 | 63 | 10/14/2025 |
| 0.18.0 | 49 | 10/11/2025 |
| 0.17.0 | 67 | 8/21/2025 |
| 0.16.0 | 63 | 7/19/2025 |
| 0.15.0 | 105 | 5/23/2025 |
| 0.14.0 | 71 | 5/20/2025 |
| 0.13.0 | 100 | 4/7/2025 |
| 0.12.0 | 87 | 4/7/2025 |
| 0.11.0 | 83 | 3/26/2025 |
| 0.10.0 | 85 | 3/26/2025 |
| 0.9.0 | 92 | 3/25/2025 |
| 0.8.0 | 80 | 3/25/2025 |
| 0.7.0 | 103 | 3/13/2025 |
| 0.6.2 | 186 | 2/5/2025 |
| 0.6.1 | 100 | 1/4/2025 |
| 0.6.0 | 103 | 12/24/2024 |
| 0.5.0 | 109 | 12/21/2024 |
| 0.4.0 | 101 | 10/23/2024 |
| 0.3.1 | 94 | 10/13/2024 |
| 0.3.0 | 108 | 8/17/2024 |
| 0.2.0 | 84 | 7/26/2024 |
| 0.1.0 | 95 | 7/14/2024 |