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
3
votes
2 answers

Unable to Run Program Using CommandLineParser Package

I am trying to add some command line arguments to my application using CommandLineParser: using CommandLine; using System; namespace ConsoleApplication1 { class Options { [Option('s', "site", Required = true, HelpText =…
Bassie
  • 9,529
  • 8
  • 68
  • 159
2
votes
3 answers

C#: CommandLineParser How to parse URL?

I am working on a C# project which basically works on commands to perform certain operations. It uses CommandLineParser library to parse all these commands and respective argument. As per the new business requirement, I need to parse an URL which…
Prasad Telkikar
  • 15,207
  • 5
  • 21
  • 44
2
votes
0 answers

ConsoleTools with unnamed arguments

Description I´ve got a console application which has a lot of arguments. To manage them I use the nuget package commandlineparser. It works really nice but one argument dosen´t have a option like -r or --reload. Did anyone get a idea how to catch a…
2
votes
2 answers

Method for printing CLI11 help_text

I've search high and low and can't find this. What is the CLI11 method to print out the help. I want to be able to show the user the help when they've entered incorrect info. Also, does CLI11 throw an exception when no option are given? If not, how…
rtcdude
  • 41
  • 3
2
votes
1 answer

CommandLineParser - Use the same switch/flag multiple times

Using the CommandLineParser NuGet, when I run my application with an option like this. myapplication.exe --searchfolder "c:\my great path\" How can I use that options more than once? For example, if I want to pass in two folders... "c:\my great…
Arvo Bowen
  • 4,524
  • 6
  • 51
  • 109
2
votes
1 answer

Does CommandLine.Parser support multiple occurences of an option?

How can I support this using CommandLine.Parser ? program.exe -s file1 -t file2 -t file3
Serge Wautier
  • 21,494
  • 13
  • 69
  • 110
2
votes
1 answer

CommandLineParser library - How to use output of one option into next one

I am reading the CommandLineParser documentation and I am very interested in the way functionality is designed here: CommandLine for verbs I basically have a command line application where I need to set different parameters. Something like…
2
votes
2 answers

Only one of arguments should be allowed with CommandLineParser

Im working on a console tool which accepts some arguments and then parses to the Option class. What I need is a property that will verify if only one of many marked fields in Option class has values (arguments were delivered). Ex. Its ok when we…
user2795347
2
votes
1 answer

Assigning the same value to 2 different Properties using CommandLine Parser nuget C#

I have these 2 properties: [Option("IpAddress1")] public string IpAddress1 { get; set; } [Option("IpAddress2")] public string IpAddress2 { get; set; } and when running with these parameters: --IpAddress1 "1.1.1.1" --IpAddress2" 1.1.1.1" I get the…
Roni Fuchs
  • 271
  • 3
  • 5
2
votes
1 answer

Get invalid parameters from commandline parser

I use the commandline parser nuget. var options = new Options(); bool isInputValid = CommandLine.Parser.Default.ParseArguments(args, options); How do I get the parameters which are invalid?
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
1
vote
1 answer

How to have Options with OR relations between 2 arguments

I have a very basic question, below is my Options class. I need to establish an OR relation between j and f flags i.e anyone should be mandatory to be passed. [Option('j', "jsonfile", Required = true, HelpText = "Path to json file")] …
1
vote
2 answers

How can I access the Value of my CommandLineParser?

There is something I don't understand with the NuGet package CommandLineParser. This is the first time I see this? Let me show you first: On the left in my Auto Watch frame I can see the Value property. But, on the right, in Immediate Window I…
Bastien Vandamme
  • 17,659
  • 30
  • 118
  • 200
1
vote
2 answers

How to only allow flag Option on cmd-line using CommandLineParser

I am using the C# CommandLineParser to handle my command-line arguments. https://github.com/commandlineparser/commandline The only options I allow on the command-line are: myprogram.exe -a 4 -b -c value If I accidentally forget a dash on an…
paultechguy
  • 2,318
  • 4
  • 25
  • 34
1
vote
0 answers

Unable to parse error options in CommandLineParser

I am using commandLineParser version 2.5.0 https://github.com/commandlineparser/commandline/wiki. If there is an error, I am unable to parse which command line options are invalid. I can only find out the type of error from Current.Tag. How do I…
1
vote
1 answer

Easy way to allow options only when other is present using CommandLineParserLibrary

I am trying to implement logic using this library: I have the verb write, and options by this scheme: write (-md [-p|-s] [-t]) | (-txt [-v]) - where '|' - means or (only -p OR -s is accepted (but not necessary as shown by '[]') when using -md) Is…
Borys Fursov
  • 548
  • 2
  • 5
  • 15