You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Important**: All shell completions require git's own completion system to be enabled for the `git` command. The completions integrate with git's subcommand completion framework.
67
+
57
68
## Branch Completion Logic
58
69
59
-
All three completions dynamically fetch current worktree branches:
70
+
All three completions dynamically fetch current git branches:
60
71
61
-
-Parse output of `gtr list --porcelain` (tab-separated: `path\tbranch\tstatus`)
62
-
-Extract branch column (second field)
63
-
-Exclude the special ID `1`(main repo) if needed
72
+
-Use `git branch --format='%(refname:short)'` to get branch names
73
+
-Add special ID `1` for main repo (allows `git gtr go 1`, `git gtr editor 1`, etc.)
74
+
-Return combined list of branches + `1`for commands that accept branch arguments (go, editor, ai, rm)
64
75
65
76
## Adapter Name Updates
66
77
@@ -71,15 +82,15 @@ When adding an editor or AI adapter:
71
82
- Update `_gtr_editors` array or case statement
72
83
- Update flag completion for `--editor` in `open` command
73
84
74
-
**Zsh** (`completions/_gtr`):
85
+
**Zsh** (`completions/_git-gtr`):
75
86
76
87
- Update `_arguments` completion specs for `--editor` or `--ai`
77
88
- Use `_values` or `_alternative` for adapter names
78
89
79
90
**Fish** (`completions/gtr.fish`):
80
91
81
-
- Update `complete -c gtr` lines for editor/AI flags
82
-
- List adapter names explicitly or parse from `gtr adapter` output
92
+
- Update `complete -c git` lines for editor/AI flags
93
+
- List adapter names explicitly or parse from `git gtr adapter` output
83
94
84
95
## Keep in Sync
85
96
@@ -92,7 +103,7 @@ The three completion files must stay synchronized:
92
103
93
104
## Examples
94
105
95
-
**Adding a new command `gtr status`**:
106
+
**Adding a new command `git gtr status`**:
96
107
97
108
1. Add `status` to main command list in all three files
98
109
2. Add flag completion if the command has flags
@@ -104,7 +115,7 @@ The three completion files must stay synchronized:
104
115
2. Add `sublime` to editor list in all three completion files
105
116
3. Update help text in `bin/gtr` (`cmd_help` function)
106
117
4. Update README with installation instructions
107
-
5. Test `gtr open --editor s<TAB>` completes to `sublime`
118
+
5. Test `git gtr open --editor s<TAB>` completes to `sublime`
108
119
109
120
## Common Pitfalls
110
121
@@ -128,6 +139,6 @@ The three completion files must stay synchronized:
128
139
129
140
## Fish-Specific Notes
130
141
131
-
- Uses declarative `complete -c gtr` syntax
132
-
- Conditions can check previous arguments with `__fish_seen_subcommand_from`
142
+
- Uses `complete -c git` with custom predicates (`__fish_git_gtr_needs_command`, `__fish_git_gtr_using_command`) to handle git subcommand context
143
+
- Conditions can check previous arguments with custom functions to detect `git gtr` usage
133
144
- Can call external commands for dynamic completion
0 commit comments