After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 742402 - Add bash completion support to git-bz
Add bash completion support to git-bz
Status: RESOLVED WONTFIX
Product: git-bz
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: git-bz-maint
git-bz-maint
gnome[unmaintained]
Depends on:
Blocks:
 
 
Reported: 2015-01-05 17:28 UTC by Philip Withnall
Modified: 2018-07-10 22:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Port from optparse to argparse (14.53 KB, patch)
2015-01-05 17:28 UTC, Philip Withnall
none Details | Review
Add basic command line completion support using argcomplete (4.45 KB, patch)
2015-01-05 17:28 UTC, Philip Withnall
none Details | Review
Add command line completers for product and component names (7.22 KB, patch)
2015-01-05 17:28 UTC, Philip Withnall
none Details | Review
Add caching of product names and components (4.28 KB, patch)
2015-01-05 17:28 UTC, Philip Withnall
none Details | Review
Document bash completion (973 bytes, patch)
2015-01-05 17:28 UTC, Philip Withnall
none Details | Review
Port from optparse to argparse (14.53 KB, patch)
2015-01-05 17:31 UTC, Philip Withnall
none Details | Review
Add basic command line completion support using argcomplete (4.45 KB, patch)
2015-01-05 17:31 UTC, Philip Withnall
none Details | Review
Add command line completers for product and component names (7.22 KB, patch)
2015-01-05 17:32 UTC, Philip Withnall
none Details | Review
Add caching of product names and components (4.28 KB, patch)
2015-01-05 17:32 UTC, Philip Withnall
none Details | Review
Document bash completion (973 bytes, patch)
2015-01-05 17:32 UTC, Philip Withnall
none Details | Review
Port from optparse to argparse (14.81 KB, patch)
2015-01-05 17:46 UTC, Philip Withnall
none Details | Review
Add basic command line completion support using argcomplete (3.90 KB, patch)
2015-01-05 17:46 UTC, Philip Withnall
none Details | Review
Add command line completers for product and component names (7.27 KB, patch)
2015-01-05 17:46 UTC, Philip Withnall
none Details | Review
Add caching of product names and components (4.33 KB, patch)
2015-01-05 17:46 UTC, Philip Withnall
none Details | Review
Document bash completion (1023 bytes, patch)
2015-01-05 17:46 UTC, Philip Withnall
none Details | Review

Description Philip Withnall 2015-01-05 17:28:02 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.
Comment 1 Philip Withnall 2015-01-05 17:28:05 UTC
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.
Comment 2 Philip Withnall 2015-01-05 17:28:13 UTC
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.
Comment 3 Philip Withnall 2015-01-05 17:28:19 UTC
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.
Comment 4 Philip Withnall 2015-01-05 17:28:27 UTC
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.
Comment 5 Philip Withnall 2015-01-05 17:28:33 UTC
Created attachment 293851 [details] [review]
Document bash completion
Comment 6 Philip Withnall 2015-01-05 17:31:45 UTC
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.
Comment 7 Philip Withnall 2015-01-05 17:31:52 UTC
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.
Comment 8 Philip Withnall 2015-01-05 17:32:00 UTC
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.
Comment 9 Philip Withnall 2015-01-05 17:32:08 UTC
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.
Comment 10 Philip Withnall 2015-01-05 17:32:18 UTC
Created attachment 293857 [details] [review]
Document bash completion
Comment 11 Philip Withnall 2015-01-05 17:46:09 UTC
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.
Comment 12 Philip Withnall 2015-01-05 17:46:15 UTC
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.
Comment 13 Philip Withnall 2015-01-05 17:46:23 UTC
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.
Comment 14 Philip Withnall 2015-01-05 17:46:30 UTC
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.
Comment 15 Philip Withnall 2015-01-05 17:46:38 UTC
Created attachment 293862 [details] [review]
Document bash completion
Comment 16 Philip Withnall 2015-01-05 17:47:36 UTC
Sorry about the multiple obsolete patch sets. Turns out that dogfooding git-bz can be dangerous.
Comment 17 Antonio Ospite 2017-11-08 09:27:43 UTC
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
Comment 18 André Klapper 2018-07-10 22:11:13 UTC
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.