This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Command line options for setup


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]