optik...what about subcommands, then? :) (fwd)

"leon j. breedt" <[email protected]> Sun, 4 May 2003 09:59:56 +1200
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi!

i innappropriately sent this mail to Greg Ward, instead of the
list, apologies.

here goes:

i have a question about feasibility w.r.t. extending
Optik for a particular use.

i have an application i'm currently writing, that uses
the concept of 'subcommands'. basically, a subcommand
is an argument with special meaning. best explained
with an example:

$ ./myapp -v snapshot -R

in the above, -v would be a 'global' option, snapshot
a 'subcommand' argument, and -R an option to 'snapshot'
and not a 'global' option (i.e. would not show up on
help, unless we're displaying help for the 'snapshot'
subcommand). if there is no argument matching a known
subcommand, it is an error, at least one is required.

i was wondering how this could be best implemented using
Optik. i tried to subclass OptionParser, but that quickly
get messy. then i was wondering if a special subclass
of OptionGroup could do the trick. but once again, that
will require more changes to OptionParser than i want to
do, i think. another approach i considered was preparsing
the argument list, and creating a seperate OptionParser
for the different slices i wanted to parse. but then
i lose the nice help output :)

i don't need infinite levels of nestedness (thats insane
anyway), just one extra level.

any suggestions on the approach to take? please Cc me
on replies, i'm not subscribed to the list.

thanks,
leon

- -- 
in the beginning, was the code.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+tDvcRWcl5mzp4f4RAhqCAJ9+Mo8G6gtkhBObozuEEZNUetVkMQCfb/ih
LqyR8jZGaNtWumSnOt0nzss=
=Recp
-----END PGP SIGNATURE-----


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf