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