Re: philosophical question
Robert Collins <[email protected]> Sat, 14 Aug 2004 22:37:20 +1000
| Newsgroups | gmane.comp.python.optik.user |
|---|---|
| Message-ID | <1092487040.27241.5.camel@localhost> |
On Sat, 2004-08-14 at 02:31, Eric O. Angell wrote: > I've read through most of the optparse documentation a couple of times (I've > mostly skipped the callbacks section since I'm not using any, but I've read > the rest), and I have a question about intent that isn't addressed anywhere I > can see. > > What is the intended purpose of option groups? I'm writing a script that has > several different possible actions, each of which are affected by a mostly > disjoint set of options. It seemed to make sense to me to separate the > options for each action by putting them in different option groups so that the > help message prints in a reasonable manner, which works almost beautifully. > The problem I ran into was that the different option sets are *almost* > disjoint. I have one option that applies to two different actions, so I want > it to appear in the help message of each group. I'm currently working around > this by turning off the conflict handler when I add it the second time, but > the need to do that makes it pretty clear that my idea is outside the > philosophy. Since there's no clear explanation of the purpose of option > groups in the documentation (the "Dangerous Options" example is a start, but I > was hoping for something more), I was hoping to get some insight from the > list. > > You're probably going to tell me that my script is behaving too much like tar > in requiring a command as an argument, huh? I've toyed with the idea of > either writing it as several different scripts or letting it be called by one > of several different names, but that just seems like it would increase > maintenence difficulty. The latter option isn't really feasible anyway, since > Windows and CVS both handle symlinks poorly. symlinking the name is a bad idea IMO. That said, I consider the option groups thing to be a bug - but there are two different ways to address it: allow the option to be in multiple groups allow the option to be added twice, one group each time, and with potentially different syntax/type etc. which fits your needs more ? Rob -- GPG key available at: <http://www.robertcollins.net/keys.txt>.
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBBHgeAM4BfeEKYx2ERAn+2AKCFoLVM3VlqScneMQi/6Pb2xoSkagCeOnXK cJXTLcfdum/pYT0gQMj6uEU= =QQgg -----END PGP SIGNATURE-----