git: Add git-bug status toggle alias gbo

Requires bug-id to be passed and toggles the corresponding bug open or
closed (`gbo <bug-id>`). Otherwise just passes through any arguments to
the `git-bug bug status` command.
This commit is contained in:
Marty Oehme 2025-02-24 12:22:25 +01:00
parent 133910be08
commit e523aa74b2
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -58,12 +58,22 @@ if [ -x "$(command -v vipe)" ] && [ -x "$(command -v jq)" ]; then
}
fi
# TODO: edit bug title
alias gbte='git-bug bug title edit'
# TODO: Implement toggle function
# grab current status and then open or close accordingly
alias gbo='git-bug bug status close'
# Toggles status of bug passed
# or passes through to bug status
gbo() {
if git-bug bug status "$1" >/dev/null 2>/dev/null; then
cur=$(git-bug bug status "$1")
if [ "$cur" = "open" ]; then
git-bug bug status close "$1"
elif [ "$cur" = "closed" ]; then
git-bug bug status open "$1"
fi
else
git-bug bug status "$@"
fi
}
alias gbp='git-bug push'
alias gbl='git-bug pull'