GNOME Bugzilla – Bug 742402
Add bash completion support to git-bz
Last modified: 2018-07-10 22:11:13 UTC
Patches attached as a first attempt at doing this. They port from optparse to argparse, which allows us to use argcomplete to do the heavy lifting for the completion. One key problem remains: due to the way argcomplete hooks into bash_completion.d, completion only works when commands are entered as `git-bz …` rather than `git bz …`. We need to somehow hook the new completion stuff into git’s bash completion functions, by implementing a _git_bz() bash function. I got quite bogged down trying to get the COMP variables set correctly, and couldn’t get _git_bz() to work. This is a start, though.
Created attachment 293847 [details] [review] Port from optparse to argparse optparse is deprecated, argparse simplifies subcommand handling, and argparse allows for automatic bash completion support.
Created attachment 293848 [details] [review] Add basic command line completion support using argcomplete This adds a dependency on argcomplete. It doesn’t support custom completers yet, but all existing argparse arguments and subcommands are supported.
Created attachment 293849 [details] [review] Add command line completers for product and component names Using the Bugzilla XML-RPC API. This is really, really slow at the moment, and needs some local caching to make it usable.
Created attachment 293850 [details] [review] Add caching of product names and components This makes command line completion reasonably fast after the first time each product is used.
Created attachment 293851 [details] [review] Document bash completion
Created attachment 293853 [details] [review] Port from optparse to argparse optparse is deprecated, argparse simplifies subcommand handling, and argparse allows for automatic bash completion support.
Created attachment 293854 [details] [review] Add basic command line completion support using argcomplete This adds a dependency on argcomplete. It doesn’t support custom completers yet, but all existing argparse arguments and subcommands are supported.
Created attachment 293855 [details] [review] Add command line completers for product and component names Using the Bugzilla XML-RPC API. This is really, really slow at the moment, and needs some local caching to make it usable.
Created attachment 293856 [details] [review] Add caching of product names and components This makes command line completion reasonably fast after the first time each product is used.
Created attachment 293857 [details] [review] Document bash completion
Created attachment 293858 [details] [review] Port from optparse to argparse optparse is deprecated, argparse simplifies subcommand handling, and argparse allows for automatic bash completion support.
Created attachment 293859 [details] [review] Add basic command line completion support using argcomplete This adds a dependency on argcomplete. It doesn’t support custom completers yet, but all existing argparse arguments and subcommands are supported.
Created attachment 293860 [details] [review] Add command line completers for product and component names Using the Bugzilla XML-RPC API. This is really, really slow at the moment, and needs some local caching to make it usable.
Created attachment 293861 [details] [review] Add caching of product names and components This makes command line completion reasonably fast after the first time each product is used.
Created attachment 293862 [details] [review] Document bash completion
Sorry about the multiple obsolete patch sets. Turns out that dogfooding git-bz can be dangerous.
JFTR the first patch also happens to fix the small issue of "git-bz --help" returning the exit code 1 to the shell instead of the more commonly expected 0. Ciao, Antonio
git-bz saw its last code changes three years ago: http://git.fishsoup.net/cgit/git-bz/ GNOME is moving from Bugzilla (the "bz" in "git-bz") to Gitlab. Closing this report as WONTFIX as part of Bugzilla Housekeeping. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as Bugzilla is deprecated) if active development is about to take place again.