[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Select a startup class from the command line


Is this possible?

Some programs run different interfaces depending on the "command" specified on the command line, notably (or perhaps notoriously) "apt". Such as:

apt get <params> apt install <params> apt this-that-and-the-other <params>

In my case, I'm trying to develop a library to interface to the OpenWeatherMap feed. It will have 3 modes of operation (so far):

 * as a library called from a client application, via an exposed
   interface class "Weather"
 * as a normal executable to allow the user to setup some configuration
   data, such as language, API key, etc
 * as a normal executable that just shows the weather for a location
   through a small UI

For the latter two then I want to specify which interface to use is a similar way to the "apt" command:

 * weather configure
 * weather [show] <location params>
   /[show] is optional, if included, the data is just printed on stdout/

Note, this is different from the normal usage of the gb.args component where the "options" must come before the "arguments". Here I have a syntax of

    weather <command>  <args> <options>

So for example,

    weather show -67.42137331544458, 164.77271477068862 -l zu

would print the current weather conditions on Sturge Island to stdout in the zulu language (should I ever require it 😕).

tia

bruce


Follow-Ups:
Re: Select a startup class from the command lineBruce Steers <bsteers4@xxxxxxxxx>