Stephen Hahn wrote:
* Darren J Moffat <[email protected]> [2009-08-27 17:18]:
I'd like code/design review feedback for this minor pkg CLI RFE I've
just logged:
I often start typing commands and forget what the exact usage is, so I
have a habit of tagging "--help" on at the very end so I get the usage
and then retrieved the command again via histroy and replace just the
last part of it (ie removing the --help).
For example:
$ pkg image-update --help
pkg image-updateh: illegal option -- help
Try `pkg --help or -?' for more information.
$ pkg search -r --help
pkg search: illegal option -- help
Try `pkg --help or -?' for more information.
What I wanted there was the full usage message not he short one.
I'd expect to get that short message if I gave an invalid option.
"--help" is valid but only directly after pkg and before the subcommand.
I find this too restrictive and would preffer the more flexible behaviour.
Webrev: http://cr.opensolaris.org/~darrenm/pkg/
The client.py change seems reasonable, although I would probably
be overprecise and introduce a new exception for a "UsageRequest".
Maybe others care less?
Do you mean so that it would look something like this:
exception getopt.UsageRequest
usage(full=True)
exception getopt.GetoptError, e:
usage(_("illegal option -- %s") % e.opt, cmd=subcommand)
That requires changing core python libs so I can't do that.
So I guess you mean having UsageRequest exception handler in client.py
handle_errors function. I tried that and I couldn't get it to work for
the special cased "image-create" but I could get that for the other
cases. Pretty much the same number of lines of code. Probably lack of
Python knowledge on my part. So is my original proposed fix okay ?
If so can you do the push for me since I don't have commit rights.
For the other fix, that looks fine, too. Thanks for catching the
awk(1)/nawk(1) inconsistency.
Thanks, Danek had already reviewed that one and I'm waiting on an okay
from Dan Price because of the zones impact. Do you think Dan's input is
still needed for 10428 given you have also review this now ?
--
Darren J Moffat
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss