Questions tagged [command-line-parser]

The Command Line Parser Library offers to .NET CLR applications a clean and concise API for manipulating command line arguments and related tasks.

From the project's readme:

The Command Line Parser Library offers CLR applications a clean and concise API for manipulating command line arguments and related tasks, such as defining switches, options and verb commands. It allows you to display a help screen with a high degree of customization and a simple way to report syntax errors to the end user.

51 questions
44
votes
3 answers

Command Line Parser Library - Boolean Parameter

I try to pass a boolean parameter to a console application and process the value with the Command Line Parser Library. [Option('c', "closeWindow", Required = true, HelpText = "Close the window.")] public bool CloseWindow { get; set; } I tried to…
Sebastian S.
  • 1,173
  • 3
  • 13
  • 22
10
votes
1 answer

C# CommandLineParser --help printing then stopping

I'm building a C# console app which uses CommandLineParser to get some arguments from cmd. The library already comes by default with the --help (or help verb) to display help information about each parameter accepted. Now when I run the --help…
Fede E.
  • 2,118
  • 4
  • 23
  • 39
9
votes
3 answers

Set command line option to false

I'm using the Command Line Parser Library I obtained via NuGet in my C# Console Application, .NET Framework 4.0. Here's my options class... class Options { [Option('p', "prompt", DefaultValue = true, HelpText = "Prompt the user before exiting…
mason
  • 31,774
  • 10
  • 77
  • 121
8
votes
1 answer

HelpVerbOption is not working - Command Line Parser C#

I have a class: class Options { // Remainder omitted (verb1, verb2, verb3) [HelpVerbOption] public string GetUsage(string verb) { return HelpText.AutoBuild(this, verb); } } The docs say: [...] The parser will pass null…
7
votes
1 answer

Default values for lists/arrays using Command Line Parser Library

Using Command Line Parser Library and having a list or array with a default value, the default value is printed as (Default: System.String[]). Is there any way to make it show the actual default values? So with [OptionList('l', "languages",…
PHeiberg
  • 29,411
  • 6
  • 59
  • 81
6
votes
1 answer

How can you access the Value property of a CommandLine Parsed?

How can you access the Value property of a CommandLine Parsed ? Trying to use the CommandLineParser The wiki section on Parsing says the instance of T can be access through the Value property ... If parsing succeeds, you'll get a derived Parsed…
SteveC
  • 15,808
  • 23
  • 102
  • 173
6
votes
1 answer

How to access unbound parameters in C# CommandLine Parser by gsscoder?

There's a CommandLine parser library for C# written by gsscoder (it has its own SO tag and I'm adding it). It parses command-line options in getopt style, i.e.: myprogram --foo --bar=baz abc def ghi It can also have so called “unbound” parameters,…
Mikhail Edoshin
  • 2,639
  • 16
  • 25
5
votes
1 answer

Reporting unknown arguments using CommandLineParser

Is there any way to make the Command Line Parser library report unknown arguments? Given the following options class: public class Options { [Option('i', "int-option", DefaultValue = 10, HelpText = "Set the int")] public int IntOption { get;…
PHeiberg
  • 29,411
  • 6
  • 59
  • 81
4
votes
1 answer

How to retrieve the args array after using AddCommandLine

I am working on a POC for a console application and I am struggling to retrieve the command line values from the configuration after using AddCommandLine in the set up. csproj Exe
onesixtyfourth
  • 744
  • 9
  • 30
4
votes
2 answers

Command Line Parser Library parsing a List of Enums

I'm trying to get a list of enums as an option. [OptionList('m', "modules", HelpText = "List of modules you are going to install or uninstall.")] public List Modules { get; set; } Unfortunately it expects it to be a list of…
MaiOM
  • 916
  • 2
  • 13
  • 28
4
votes
1 answer

Marking required set required with CommandLine Parser Library

Using Command Line Parser Library, is there a way to mark a set of say 3 options and make exactly one of the three options required? So having these options: [Option("list-plugins", MutuallyExclusiveSet = "Commands")] public bool ListPLugins { get;…
PHeiberg
  • 29,411
  • 6
  • 59
  • 81
3
votes
0 answers

CommandLineParser: get Name of Mutually Exclusive Options Set

Using CommandLineParser I can define a set of mutually exclusive options like this (taken from the wiki): class OptionsMutuallyExclusive { //define commands in set(group) named web [Option(SetName = "web")] public string DocumentRoot { get;…
sc911
  • 1,130
  • 10
  • 18
3
votes
6 answers

Parse command line arguments/options in C#

I have a console application with some arguments and options so I would like to use a free third-party library. I have found two libraries for this purpose: NDesk.Options and Command Line Parser Library Finally I have decided to use Command Line…
Willy
  • 9,848
  • 22
  • 141
  • 284
3
votes
2 answers

How to view CommandLineParser parsing errors in Visual Studio 2015?

I'm trying to see the errors that occur when parsing command-line arguments using the CommandLineParser package and Visual Studio Professional 2015 (Update 3). Here is the code I'm working with: using System; using System.IO; namespace…
Mass Dot Net
  • 2,150
  • 9
  • 38
  • 50
3
votes
1 answer

Command Line - bool argument doesn't work

I am trying to use bool argument in my console application. I'm using the CommandLineParser Package, but parser return error. this is my option [Option("randomize", Required = false, DefaultValue = false, HelpText = "Enter \"true\" for the…
Tomáš Čičman
  • 281
  • 1
  • 5
  • 17
1
2 3 4