Suggestions for implementation of a command line interface

I see a lot of Windows command line specifics, but if your program is intended for Linux, I find the GNU command line standard to be the most intuitive. Basically, it uses double hyphens for the long form of a command (e.g., --help) and a single hyphen for the short version (e.g., -h). You can also "stack" the short versions together (e.g., tar -zxvf filename) and mix 'n match long and short to your heart's content.

The GNU site also lists standard option names.

The getopt library greatly simplifies parsing these commands. If C's not your bag, Python has a similar library, as does Perl.


If you are using C# try Mono.GetOptions, it's a very powerful and simple-to-use command-line argument parser. It works in Mono environments and with Microsoft .NET Framework.

EDIT: Here are a few features

  • Each param has 2 CLI representations (1 character and string, e.g. -a or --add)
  • Default values
  • Strongly typed
  • Automagically produces an help screen with instructions
  • Automagically produces a version and copyright screen