commandl Library

Latest Version: Beta-1

A bit of History

My first experiences performing command line parsing for my programs was doing it by hand, for each program individually. It was a great solution the first time, but got progressively worse every time I found myself spending almost as much time on the argument parsing logic as on the program I was trying to write. In my early days I wrote a lot of Perl, and eventually discovered the GetOpt modules, and they made things so much easier. I found myself doing more and more things in Perl just to take advantage of that functionality. Once I finally learned what object oriented programming was all about, I was hooked, although I lamented the absence of the Perl GetOpts modules. So I figured that there must be some enterprising person who had gone out and written something that would do the same thing.

After much Googling around, I stumbled upon Brad Appleton's CmdLine package. It dealt with arguments as objects and dealt with things in a reasonably abstract manner, and I was very happy. Then GCC came out with version 3 of its fabulous compiler suite, and CmdLine broke! I was devastated, one of my favorite crutches was written in very non-standards compliant C++. A friend of mine (another Brad coincidentally), who was much more versed in C and C++ than I was took a look at it, and patched it a bit for me. However, much like a cancer patient on the way out, I was told that it "didn't look good." Unfortunately, at this point, the last date stamp on the CmdLine code was four years old, and I had no illusions of active development. So I decided that I really needed a good project to do in C++, I certainly needed an argument parser, and so I embarked on trying to understand the CmdLine code and rewrite it.

This failed, I didn't really understand what was going on in that code, and a lot of it seemed weird to me. So I decided to start fresh and write my own command line parsing library. Something that was clean, abstract, and as standards-compliant as I could make it. For good or ill, this package is the fruit of that labor.

How did it get named, you ask? Well, if you look through the code, you'll find that I am a big fan of verbose names, so I was originally going to go with something like command_line_parser or something, but I knew that if I did this, people who did a listing of the directory with this library in it, would curse my name for all eternity for making their listings only a single column because my library name was so wicked long. Since the C++ standard had alread abbreviated "line" as "l", as in the "endl" manipulator, I figured that commandl was good, short, and unique. It also satisfied my perverse sense of humor in that the word I had abbreviated was shorter than the word I had left spelled out. Of course, it wasn't until later that I realized that you'll hardly ever use this name because there is no commandl class (just arguments, matchers, parsers, and what not), just a convenient header file, so there you go.