Command line options for setup

Robert Collins robert.collins@itdomain.com.au
Tue Mar 26 20:26:00 GMT 2002


Hi Keith, 
	I hope I haven't stolen your thunder, but I've checked into HEAD
the framework for command line options for setup. I've not used what you
put together, because it was too procedural.

Instead, we have:
GetOption - a singleton class that abstracts the getopt() mechanics.
Each option registers with it at process startup, and main() calls
GetOption::GetInstance().Process(argc, argv);

This means that main.cc is completely unaffected by addition and removal
of options.

Secondly, there is an abstract class Option that each option inherits
from (we can probably look at a template at some point). The concrete
classes need to be singletons, to ensure their registration at process
startup. (Their constructor calls
GetOption::GetInstance().Register(this);).

See desktop.h and desktop.cc for a sample option (--no-shortcuts or -n).

Anyway, this will hopefully act as a seed, and allow you (or anyone else
interested in adding command line options) to do so without having to
invent the infrastructure as well.

Cheers,
Rob



More information about the Cygwin-apps mailing list