-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced shell completion #493
Labels
Comments
I want to work on this |
Yes please! |
krobelus
added a commit
to krobelus/git-bug
that referenced
this issue
Jan 24, 2021
This completes bug IDs in bash and fish. I haven't gotten this to work in zsh. In fish, the bug titles are shown as completion label, and can be searched for. I don't know if/how other shells can show the completion label. Maybe they don't use "\t" as separator but it seems to do no harm. The interface does not yet seem ideal because sometimes subcommands and bug IDs are both valid. Since there can be lots of bug IDs, they overshadow the subcommands. I wonder if instead of git bug status open 0123acd we should use git bug status --open 0123acd or if there's some other way to avoid ambiguity. If that doesn't work out, fish has a -k/--keep-order flag, so subcommand completions can be listed before bug IDs, but that's neither portable nor a pretty solution. Part of git-bug#493
As a first step, I have added bug ID completions. They work well in fish, I'm not sure how to make completions work in zsh. |
krobelus
added a commit
to krobelus/git-bug
that referenced
this issue
Jan 24, 2021
This completes bug IDs in bash and fish. I haven't gotten this to work in zsh. In fish, the bug titles are shown as completion label, and can be searched for. I don't know if/how other shells can show the completion label. Maybe they don't use "\t" as separator but it seems to do no harm. The interface does not yet seem ideal because sometimes subcommands and bug IDs are both valid. Since there can be lots of bug IDs, they overshadow the subcommands. I wonder if instead of git bug status open 0123acd we should use git bug status --open 0123acd or if there's some other way to avoid ambiguity. If that doesn't work out, fish has a -k/--keep-order flag, so subcommand completions can be listed before bug IDs, but that's neither portable nor a pretty solution. Part of git-bug#493
krobelus
added a commit
to krobelus/git-bug
that referenced
this issue
Jan 24, 2021
This completes bug IDs in bash and fish. I haven't gotten this to work in zsh. In fish, the bug titles are shown as completion label, and can be searched for. I don't know if/how other shells can show the completion label. Anyway, everything after the "\t" separator seems to be ignored. Part of git-bug#493
krobelus
added a commit
to krobelus/git-bug
that referenced
this issue
Jan 25, 2021
Complete bug IDs, bridges, users, labels where appropriate. This works in bash and fish. ZSH is not yet supported by Cobra. In fish, descriptions (the part of a completion after the "\t") are shown as completion label, and can be searched. Closes git-bug#493
krobelus
added a commit
to krobelus/git-bug
that referenced
this issue
Feb 10, 2021
Complete bug IDs, bridges, users, labels where appropriate. This works in bash and fish. ZSH is not yet supported by Cobra. In fish, descriptions (the part of a completion after the "\t") are shown as completion label, and can be searched. Closes git-bug#493
What is the status on this issue? |
krobelus
added a commit
to krobelus/git-bug
that referenced
this issue
Aug 1, 2021
Complete bug IDs, bridges, users, labels where appropriate. This works in bash and fish. ZSH is not yet supported by Cobra. In fish, descriptions (the part of a completion after the "\t") are shown as completion label, and can be searched. Closes git-bug#493
krobelus
added a commit
to krobelus/git-bug
that referenced
this issue
Mar 2, 2022
Complete bug IDs, bridges, users, labels where appropriate. This works in bash and fish. ZSH is not yet supported by Cobra. In fish, descriptions (the part of a completion after the "\t") are shown as completion label, and can be searched with Ctrl+S. Reproduce with fish -C 'source misc/fish_completion/git-bug' git bug select ^I (tested with fish version 3.3.1) Also works with bash, but only for "git-bug" (with the dash) bash --rcfile <(echo source misc/bash_completion/git-bug) git-bug select ^I Closes git-bug#493
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cobra, the library used to implement the CLI commands also generate the shell completion scripts, for bash, zsh, fish and powershell. This completion scripts are based on the description of each commands (living in https://github.com/MichaelMure/git-bug/tree/master/commands).
At the moment, those completion works decently, completing command names and flags. However it would be possible to do better. By teaching cobra (see https://github.com/spf13/cobra/blob/master/shell_completions.md#customizing-completions) about what is expected, it should be possible to:
git bug ls [tab][tab]
would also complete with query qualifiers)git bug show [tab][tab]
would complete with bug Ids, possibly with the bug title)The text was updated successfully, but these errors were encountered: