git: Show bug description if bug id passed to gb

The alias `gb` will list all bugs (or allows to query for them) by
default. But if only a single argument is provided, and that argument is
a bug id then it shows the bug.

This allows a nice workflow like:

```sh
$ gb
# -> returns list of bugs, pick one from it
$ gb <bug-id>
# -> returns detailed description of bug
```
This commit is contained in:
Marty Oehme 2025-02-24 12:11:52 +01:00
parent 5986206e51
commit 133910be08
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -9,7 +9,13 @@ fi
git-bug completion zsh | . /dev/fd/0
alias gbt='git-bug termui'
alias gb="git-bug bug"
gb() {
if [ "$#" -eq 1 ] && git-bug bug status "$1" >/dev/null 2>/dev/null; then
git-bug bug show "$1"
else
git-bug bug "$@"
fi
}
alias gbw="git-bug bug show"
alias gbs="git-bug bug select"