Skip to content

Commit 3298796

Browse files
authored
fix(completions): remove ghost flag and add missing completions (#111)
- Remove --id flag from Bash completions (never existed in code) - Add --porcelain completion for list/ls in Bash and Fish - Add --editor flag with adapter names for editor command in Bash and Fish - Add --ai flag with adapter names for ai command in Bash and Fish Brings Bash and Fish completions to parity with Zsh.
1 parent 1be09e1 commit 3298796

2 files changed

Lines changed: 41 additions & 2 deletions

File tree

completions/git-gtr.fish

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ complete -c git -n '__fish_git_gtr_using_command copy' -s n -l dry-run -d 'Previ
8383
complete -c git -n '__fish_git_gtr_using_command copy' -s a -l all -d 'Copy to all worktrees'
8484
complete -c git -n '__fish_git_gtr_using_command copy' -l from -d 'Source worktree' -r
8585

86+
# List command options
87+
complete -c git -n '__fish_git_gtr_using_command list' -l porcelain -d 'Machine-readable output'
88+
complete -c git -n '__fish_git_gtr_using_command ls' -l porcelain -d 'Machine-readable output'
89+
90+
# Editor command options
91+
complete -c git -n '__fish_git_gtr_using_command editor' -l editor -d 'Editor to use' -r -a 'cursor vscode zed idea pycharm webstorm vim nvim emacs sublime nano atom none'
92+
93+
# AI command options
94+
complete -c git -n '__fish_git_gtr_using_command ai' -l ai -d 'AI tool to use' -r -a 'aider auggie claude codex continue copilot cursor gemini opencode none'
95+
8696
# Clean command options
8797
complete -c git -n '__fish_git_gtr_using_command clean' -l merged -d 'Remove worktrees with merged PRs/MRs'
8898
complete -c git -n '__fish_git_gtr_using_command clean' -l yes -d 'Skip confirmation prompts'

completions/gtr.bash

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ _git_gtr() {
3030

3131
# Commands that take branch names or '1' for main repo
3232
case "$cmd" in
33-
go|run|editor|ai|rm|mv|rename)
33+
go|run|rm|mv|rename)
3434
if [ "$cword" -eq 3 ]; then
3535
# Complete with branch names and special ID '1' for main repo
3636
local branches all_options
@@ -48,6 +48,35 @@ _git_gtr() {
4848
esac
4949
fi
5050
;;
51+
editor)
52+
if [[ "$cur" == -* ]]; then
53+
COMPREPLY=($(compgen -W "--editor" -- "$cur"))
54+
elif [ "$prev" = "--editor" ]; then
55+
COMPREPLY=($(compgen -W "cursor vscode zed idea pycharm webstorm vim nvim emacs sublime nano atom none" -- "$cur"))
56+
else
57+
local branches all_options
58+
branches=$(git branch --format='%(refname:short)' 2>/dev/null || true)
59+
all_options="1 $branches"
60+
COMPREPLY=($(compgen -W "$all_options" -- "$cur"))
61+
fi
62+
;;
63+
ai)
64+
if [[ "$cur" == -* ]]; then
65+
COMPREPLY=($(compgen -W "--ai" -- "$cur"))
66+
elif [ "$prev" = "--ai" ]; then
67+
COMPREPLY=($(compgen -W "aider auggie claude codex continue copilot cursor gemini opencode none" -- "$cur"))
68+
else
69+
local branches all_options
70+
branches=$(git branch --format='%(refname:short)' 2>/dev/null || true)
71+
all_options="1 $branches"
72+
COMPREPLY=($(compgen -W "$all_options" -- "$cur"))
73+
fi
74+
;;
75+
ls|list)
76+
if [[ "$cur" == -* ]]; then
77+
COMPREPLY=($(compgen -W "--porcelain" -- "$cur"))
78+
fi
79+
;;
5180
clean)
5281
if [[ "$cur" == -* ]]; then
5382
COMPREPLY=($(compgen -W "--merged --yes -y --dry-run -n" -- "$cur"))
@@ -67,7 +96,7 @@ _git_gtr() {
6796
new)
6897
# Complete flags
6998
if [[ "$cur" == -* ]]; then
70-
COMPREPLY=($(compgen -W "--id --from --from-current --track --no-copy --no-fetch --no-hooks --force --name --folder --yes --editor -e --ai -a" -- "$cur"))
99+
COMPREPLY=($(compgen -W "--from --from-current --track --no-copy --no-fetch --no-hooks --force --name --folder --yes --editor -e --ai -a" -- "$cur"))
71100
elif [ "$prev" = "--track" ]; then
72101
COMPREPLY=($(compgen -W "auto remote local none" -- "$cur"))
73102
fi

0 commit comments

Comments
 (0)