Bug 26912 - bugzilla-tool should accept global options anywhere
Summary: bugzilla-tool should accept global options anywhere
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 27164
  Show dependency treegraph
 
Reported: 2009-07-01 18:25 PDT by Eric Seidel (no email)
Modified: 2009-12-23 23:18 PST (History)
4 users (show)

See Also:


Attachments
Patch (16.03 KB, patch)
2009-12-23 22:55 PST, Eric Seidel (no email)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2009-07-01 18:25:36 PDT
bugzilla-tool should accept global options anywhere

Right now bugzilla-tool makes sure that you put the global options before the command.  I don't think this is what we actually want.

Meaning:
bugzilla-tool post-diff --help
will error out instead of displaying the global help.
Likewise:
bugzilla-tool post-diff --dry-run
will be an error.

This will be simple to fix, but will require our first option-parse pass to ignore options it does not understand.
Comment 1 Eric Seidel (no email) 2009-12-10 00:08:43 PST
Adam points out that the easy way to do this would be to simply have a single option parser, and to just have the tool be smart enough to add in the options from whatever command is chosen.

Basically run looks like this:

1.  Find out where the command is in the args stream (the first arg not beginning with -)
2.  Look up the command.
3.  Build the relevant option parser.
4.  Parse options and pass them off to the command.
Comment 2 Eric Seidel (no email) 2009-12-23 22:55:40 PST
Created attachment 45463 [details]
Patch
Comment 3 WebKit Review Bot 2009-12-23 22:56:02 PST
style-queue ran check-webkit-style on attachment 45463 [details] without any errors.
Comment 4 Eric Seidel (no email) 2009-12-23 22:58:12 PST
Turns out a single option parser was not "easy", mostly because of how we depend on OptionParser for our help printing.  If we re-wrote the help printing to not use OptionParser, this code would all probably be a lot simpler.  Bleh.  Ugly patch.  I'm very glad we had unit test coverage of most of this though!
Comment 5 Adam Barth 2009-12-23 23:07:20 PST
Comment on attachment 45463 [details]
Patch

ok.  set_option_parser is kind of goofy, but this looks like it should do the job.
Comment 6 WebKit Commit Bot 2009-12-23 23:18:36 PST
Comment on attachment 45463 [details]
Patch

Clearing flags on attachment: 45463

Committed r52543: <http://trac.webkit.org/changeset/52543>
Comment 7 WebKit Commit Bot 2009-12-23 23:18:43 PST
All reviewed patches have been landed.  Closing bug.