Skip to content

fix(completions): add git gtr completion command to solve zsh timing issue#87

Merged
helizaga merged 3 commits intomainfrom
fix/zsh-completion-timing
Jan 24, 2026
Merged

fix(completions): add git gtr completion command to solve zsh timing issue#87
helizaga merged 3 commits intomainfrom
fix/zsh-completion-timing

Conversation

@helizaga
Copy link
Collaborator

@helizaga helizaga commented Jan 24, 2026

Summary by CodeRabbit

  • New Features

    • Added a built-in "completion" command to generate shell completions and made that command itself tab-completable for Bash, Zsh, and Fish.
  • Documentation

    • Simplified completion setup to use runtime generation (one-line commands for Bash/Zsh and redirect for Fish), removed manual file/symlink steps, and clarified troubleshooting and Zsh ordering notes.

✏️ Tip: You can customize this high-level summary in your review settings.

- Introduced a `completion` command to generate shell completions for Bash, Zsh, and Fish.
- Updated README and configuration documentation with setup instructions for each shell.
- Enhanced Zsh and Fish completion scripts to support the new command.
- Improved Bash completion to include the new `completion` subcommand.
@helizaga helizaga requested a review from NatoBoram as a code owner January 24, 2026 00:54
@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a runtime completion command git gtr completion <shell> with generation for bash, zsh, and fish; updates completion scripts to include the new subcommand and revises documentation to show dynamic invocation (source/eval/write) instead of manual file installs.

Changes

Cohort / File(s) Summary
Core Implementation
bin/gtr
Added cmd_completion() and dispatcher entry to emit shell-specific completion scripts at runtime
Completion Definitions
completions/_git-gtr, completions/gtr.bash, completions/git-gtr.fish
Registered new completion subcommand and added shell-name argument completions (bash, zsh, fish) for zsh, bash, and fish completion files
Documentation
README.md, docs/configuration.md
Reworked shell completions guidance to use runtime generation (examples: source <(git gtr completion bash), eval "$(git gtr completion zsh)", git gtr completion fish > <path>/.../git-gtr.fish) and updated troubleshooting link

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant Shell as Shell (interactive)
  participant GTR as git gtr

  User->>Shell: run "source <(git gtr completion bash)"\nor "eval \"$(git gtr completion zsh)\"" or "git gtr completion fish > /path/.../git-gtr.fish"
  Shell->>GTR: execute "git gtr completion <shell>"
  GTR-->>Shell: output generated completion script
  Shell->>Shell: evaluate or write completion script (register completions)
  Shell-->>User: completions available for "git gtr"
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • NatoBoram

Poem

🐰 Hopping through the terminal bright,

I print completions through the night,
Source, eval, or write with glee,
Tab-complete now, swift and free,
— a rabbit's code-made light ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a new git gtr completion command to address a zsh timing issue with shell completions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/zsh-completion-timing

Comment @coderabbitai help to get the list of available commands and usage tips.

…n.md

- Simplified setup instructions for Bash, Zsh, and Fish in both README and configuration documentation.
- Clarified the importance of the order of commands in Zsh setup.
- Removed redundant comments and streamlined the content for better readability.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/configuration.md`:
- Around line 340-342: Update the docs to ensure the target completions
directory exists before redirecting the output of the git gtr completion fish
command: explicitly create the directory ~/.config/fish/completions (using the
mkdir -p pattern) prior to writing to ~/.config/fish/completions/git-gtr.fish so
the redirect cannot fail on fresh systems.

@helizaga helizaga merged commit 0c72b0d into main Jan 24, 2026
1 check was pending
@helizaga helizaga deleted the fix/zsh-completion-timing branch January 24, 2026 00:59
helizaga added a commit that referenced this pull request Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant