Bug 27164 - webkit-patch: Individual commands should support -h|--help
Summary: webkit-patch: Individual commands should support -h|--help
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
Depends on: 26912 31697 31771
  Show dependency treegraph
Reported: 2009-07-10 16:35 PDT by David Kilzer (:ddkilzer)
Modified: 2010-03-22 20:16 PDT (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2009-07-10 16:35:40 PDT
When running bugzilla-tool, it would be useful to be able to run:

$ bugzilla-tool commandname -h

and get help on the individual command (instead of all of them).
Comment 1 David Kilzer (:ddkilzer) 2009-07-10 16:45:48 PDT
I'm not sure how to go about doing this, or I would have posted a patch already.
Comment 2 Eric Seidel (no email) 2009-07-10 16:47:32 PDT
or bugzilla-tool help commandname
like git does.

Either works.  This would compete with Ojan's request to have global arguments truly global:
Comment 3 Eric Seidel (no email) 2009-07-10 16:48:37 PDT
bzt help command
would be rather easy to implement.

You just make a new Command subclass which in execute() knows how to reach back at the command dictionary, lookup the command and then call teh right help-printing functions for the OptionParser created for the command.

Would probably need a bunch of method abstraction, but should be straightforward.
Comment 4 Eric Seidel (no email) 2009-07-10 16:50:00 PDT
I would like to abstract all my crazy command parsing stuff out into one nice OptionParser subclass some day.  Then bugzilla-tool itself has nothing to do with all the option parsing stuff, it's just a list of commands which are fed off into this fancy git-like OptionParser class.  In a future fantasy word, this subclass could go upstream to python, but I doubt we'd ever reach that.
Comment 5 Eric Seidel (no email) 2009-11-21 12:23:27 PST
The "individual help" part of this was fixed by bug 31697.  The accepting --help anywhere will be fixed by bug 26912.

I'm about to post a patch to make --help spew much much better as part of bug 31771.
Comment 6 Eric Seidel (no email) 2009-12-10 00:09:54 PST
With the proposed approach in bug 26912 of having a single options parser object, this bug will become a dupe of bug 26912.
Comment 7 Eric Seidel (no email) 2009-12-23 23:21:17 PST
Oh boy.  Well, commands support --help now, but it doesn't quite do what you might expect.  It prints the global help.  So sad. :(

I guess we're supposed to treat "tool --help command" different from "tool command --help"?  Or I guess we just have to detect that we found a command...

This might have been "easier" before parts of bug 26912.  bleh.
Comment 8 Eric Seidel (no email) 2009-12-23 23:32:04 PST
Looks like "svn commit --help" and "svn --help commit" are both equivalent to "svn help commit".  This bug is probably most easily fixed by finally biting the bullet and writing our own help printing instead of hacking into OptionParser's
Comment 9 David Kilzer (:ddkilzer) 2010-03-22 11:16:38 PDT
Can this be closed now?
Comment 10 Eric Seidel (no email) 2010-03-22 11:19:13 PDT
Well, --help functions strangely, see https://bugs.webkit.org/show_bug.cgi?id=27164#c7, but we could close this if you like.
Comment 11 David Kilzer (:ddkilzer) 2010-03-22 20:16:06 PDT
(In reply to comment #10)
> Well, --help functions strangely, see
> https://bugs.webkit.org/show_bug.cgi?id=27164#c7, but we could close this if
> you like.

Okay, let's leave it open to support -h|--help on each command some day.