Skip to content

fix(zsh): prevent trailing space after profile prefix in completions - #658

Merged
creativeprojects merged 1 commit into
masterfrom
zsh-completion-no-space-after-profile-dot
Jun 28, 2026
Merged

fix(zsh): prevent trailing space after profile prefix in completions#658
creativeprojects merged 1 commit into
masterfrom
zsh-completion-no-space-after-profile-dot

Conversation

@creativeprojects

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings June 28, 2026 14:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This pull request adjusts the zsh completion script to avoid inserting a trailing space after completing a profile prefix (e.g. default.), aligning zsh behavior with the existing bash completion behavior and enabling users to continue typing subcommands immediately after the dot.

Changes:

  • Update _resticprofile_add to treat values ending in . as “profile prefixes” and add them via compadd -S '' to prevent zsh from appending a space.
  • Refactor the zsh completion shell test harness to optionally preserve whitespace so it can assert the absence of a trailing space after profile. completions.
  • Add a new zsh test case that validates no trailing space is inserted after a profile. prefix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
contrib/completion/zsh-completion.zsh Splits profile-prefix completions (ending in .) into a separate compadd call using -S '' to prevent trailing space insertion.
completion_shell_test.go Adds a raw zsh buffer capture helper and a new test to verify profile-prefix completions do not add a trailing space.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread completion_shell_test.go
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.96%. Comparing base (f63a876) to head (f55cf96).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #658      +/-   ##
==========================================
- Coverage   81.38%   80.96%   -0.42%     
==========================================
  Files         149      162      +13     
  Lines       11340    12122     +782     
==========================================
+ Hits         9229     9814     +585     
- Misses       1639     1810     +171     
- Partials      472      498      +26     
Flag Coverage Δ
unittests 79.24% <ø> (-0.31%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@creativeprojects
creativeprojects merged commit 17f5c43 into master Jun 28, 2026
14 checks passed
@creativeprojects
creativeprojects deleted the zsh-completion-no-space-after-profile-dot branch June 28, 2026 15:21
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.

2 participants