fix(zsh): prevent trailing space after profile prefix in completions - #658
Conversation
There was a problem hiding this comment.
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_addto treat values ending in.as “profile prefixes” and add them viacompadd -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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
No description provided.