From 133910be080becf64bb67add8c340ae61a98e78e Mon Sep 17 00:00:00 2001
From: Marty Oehme <contact@martyoeh.me>
Date: Mon, 24 Feb 2025 12:11:52 +0100
Subject: [PATCH] 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
```
---
 vcs/git/config/sh/alias.d/git-bug.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/vcs/git/config/sh/alias.d/git-bug.sh b/vcs/git/config/sh/alias.d/git-bug.sh
index 4d8f8d6..d0485fc 100644
--- a/vcs/git/config/sh/alias.d/git-bug.sh
+++ b/vcs/git/config/sh/alias.d/git-bug.sh
@@ -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"