Question

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?

Was it helpful?

Solution

OTHER TIPS

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.

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

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top