1

I need a command line parsing utility. In the brief 10 second that I've spent googling, I found NConsoler. Can anybody recommend anything else?

Jaimal Chohan
  • 8,530
  • 6
  • 43
  • 64
  • 5
    Please specify at least your operating system requirements, and which language you're working in. – unwind Sep 10 '09 at 12:55
  • Sorry, I should have tagged it .NET (althought NConsoler is for .NET console apps...) – Jaimal Chohan Sep 10 '09 at 13:34
  • In that case it is a dupe of http://stackoverflow.com/questions/631410/looking-for-a-command-line-argument-parser-for-net/1401547#1401547 – EBGreen Sep 10 '09 at 13:45

5 Answers5

4

If you're interested in .NET (your question doesn't give any information) I've had the Plossum.CommandLine library recommended to me before now. I haven't used it myself, but you might want to take a look.

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
3

You can take a look at

http://commandline.codeplex.com/

and

GetPot command line parser

rahul
  • 184,426
  • 49
  • 232
  • 263
2

If you are talking about .NET then see the answers to this question.

Community
  • 1
  • 1
Mike Two
  • 44,935
  • 9
  • 80
  • 96
1

The BizArk library contains a command-line parser.

Basically you just create a class that inherits from CmdLineObject, add properties that you want populated from the command-line, add a CmdLineArgAttribute to the properties, then call Initialize in your program. It supports ClickOnce URL arguments too!

Features (from the site)...

  • Automatic initialization: Class properties are automatically set based on the command-line arguments.
  • Default properties: Send in a value without specifying the property name.
  • Value conversion: Uses the powerful ConvertEx class also included in BizArk to convert values to the proper type.
  • Boolean flags. Flags can be specified by simply using the argument (ex, /b for true and /b- for false) or by adding the value true/false, yes/no, etc.
  • Argument arrays. Simply add multiple values after the command-line name to set a property that is defined as an array. Ex, /x 1 2 3 will populate x with the array { 1, 2, 3 } (assuming x is defined as an array of integers).
  • Command-line aliases: A property can support multiple command-line aliases for it. For example, Help uses the alias ?.
  • Partial name recognition. You don’t need to spell out the full name or alias, just spell enough for the parser to disambiguate the property/alias from the others.
  • Supports ClickOnce: Can initialize properties even when they are specified as the query string in a URL for ClickOnce deployed applications. The command-line initialization method will detect if it is running as ClickOnce or not so your code doesn’t need to change when using it.
  • Automatically creates /? help: This includes nice formatting that takes into account the width of the console.
  • Load/Save command-line arguments to a file: This is especially useful if you have multiple large, complex sets of command-line arguments that you want to run multiple times.
Brian
  • 37,399
  • 24
  • 94
  • 109
0

Google's commandline-parsing library for C++ and python: http://code.google.com/p/google-gflags/

jcd
  • 174
  • 4