feat: add missing entries for completion scripts

Several PUBLIC_COMMANDS (attributes, switch_branch, stash_push, ignore)
had no corresponding entries in the completion scripts, causing
incomplete tab completion.
This commit is contained in:
Wenxuan Zhang 2026-03-09 18:02:56 +08:00 committed by Wenxuan
parent 0a220670c0
commit 5182bb459d
2 changed files with 18 additions and 0 deletions

View file

@ -67,6 +67,7 @@ _git-forgit() {
local -a subcommands
subcommands=(
'add:git add selector'
'attributes:git attributes generator'
'blame:git blame viewer'
'branch_delete:git branch deletion selector'
'checkout_branch:git checkout branch selector'
@ -85,15 +86,19 @@ _git-forgit() {
'reset_head:git reset HEAD (unstage) selector'
'revert_commit:git revert commit selector'
'reword:git fixup=reword'
'show:git show viewer'
'squash:git squash'
'stash_show:git stash viewer'
'stash_push:git stash push selector'
'switch_branch:git switch branch selector'
'worktree:git worktree browser'
'worktree_delete:git worktree remove selector'
)
_describe -t commands 'git forgit' subcommands
;;
add) _git-add ;;
attributes) ;;
blame) ;;
branch_delete) _git-branches ;;
checkout_branch) _git-branches ;;
checkout_commit) __git_recent_commits ;;
@ -104,6 +109,7 @@ _git-forgit() {
clean) _git-clean ;;
diff) _git-forgit-diff ;;
fixup) _git-log ;;
ignore) ;;
log) _git-log ;;
reflog) _git-forgit-reflog ;;
rebase) _git-rebase ;;
@ -112,7 +118,9 @@ _git-forgit() {
reword) _git-log ;;
squash) _git-log ;;
stash_show) _git-stash-show ;;
stash_push) _git-add ;;
show) _git-show ;;
switch_branch) _git-branches ;;
worktree) _git-worktree ;;
worktree_delete) _git-worktrees ;;
esac
@ -143,6 +151,7 @@ compdef __git_recent_commits forgit::revert::commit
compdef _git-log forgit::reword
compdef _git-log forgit::squash
compdef _git-stash-show forgit::stash::show
compdef _git-add forgit::stash::push
compdef _git-show forgit::show
compdef _git-worktree forgit::worktree
compdef _git-worktrees forgit::worktree::delete

View file

@ -67,6 +67,7 @@ _git_forgit()
cmds="
add
attributes
blame
branch_delete
checkout_branch
@ -89,6 +90,7 @@ _git_forgit()
squash
stash_show
stash_push
switch_branch
worktree
worktree_delete
"
@ -100,6 +102,8 @@ _git_forgit()
3)
case ${prev} in
add) _git_add ;;
attributes) ;;
blame) ;;
branch_delete) _git_branch_delete ;;
checkout_branch) _git_checkout_branch ;;
checkout_commit) _git_checkout ;;
@ -110,6 +114,7 @@ _git_forgit()
clean) _git_clean ;;
diff) _git_diff ;;
fixup) _git_log ;;
ignore) ;;
log) _git_log ;;
reflog) _git_reflog ;;
rebase) _git_rebase ;;
@ -119,6 +124,8 @@ _git_forgit()
show) _git_show ;;
squash) _git_log ;;
stash_show) _git_stash_show ;;
stash_push) _git_stash ;;
switch_branch) _git_checkout_branch ;;
worktree) _git_worktree ;;
worktree_delete) _git_worktrees ;;
esac
@ -159,6 +166,7 @@ then
__git_complete forgit::show _git_show
__git_complete forgit::squash _git_log
__git_complete forgit::stash::show _git_stash_show
__git_complete forgit::stash::push _git_stash
__git_complete forgit::worktree _git_worktree
__git_complete forgit::worktree::delete _git_worktrees
@ -184,6 +192,7 @@ then
__git_complete "${forgit_show}" _git_show
__git_complete "${forgit_squash}" _git_log
__git_complete "${forgit_stash_show}" _git_stash_show
__git_complete "${forgit_stash_push}" _git_stash
__git_complete "${forgit_worktree}" _git_worktree
__git_complete "${forgit_worktree_delete}" _git_worktrees
fi