completion: generate fish completions, remove hand-written ones - #9990
Draft
ThomasWaldmann wants to merge 1 commit into
Draft
completion: generate fish completions, remove hand-written ones#9990ThomasWaldmann wants to merge 1 commit into
ThomasWaldmann wants to merge 1 commit into
Conversation
ThomasWaldmann
force-pushed
the
fish-completions-9989
branch
2 times, most recently
from
August 1, 2026 01:13
3b28d84 to
af89360
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9990 +/- ##
==========================================
+ Coverage 85.88% 85.94% +0.06%
==========================================
Files 95 95
Lines 17088 17187 +99
Branches 2616 2643 +27
==========================================
+ Hits 14676 14772 +96
- Misses 1674 1675 +1
- Partials 738 740 +2 ☔ View full report in Codecov by Harness. |
ThomasWaldmann
marked this pull request as draft
August 1, 2026 02:26
…borgbackup#9989 borg brings its own fish backend instead of using shtab's (new in shtab 1.9.0): it walks the parser tree and emits fish complete commands, with a preamble providing fish versions of the same dynamic completions the bash/zsh scripts have (archive names, aid: archive IDs, tags, sort keys, files cache modes, compression specs, chunker params, relative time markers, timestamps, file sizes, help topics). The generated script tracks the (sub)command path and the number of positional arguments already given, so completions are offered in the right place (e.g. the second archive name for borg diff) - more precise than shtab's __fish_seen_subcommand_from based conditions. shtab >= 1.9.2 is required now (older versions generate broken zsh completions or have no fish support), so shtab.SUPPORTED_SHELLS already contains fish and is used as-is for the SHELL argument choices. The hand-written, unmaintained fish completions in scripts/shell_completions/ are removed, as are their tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ThomasWaldmann
force-pushed
the
fish-completions-9989
branch
from
August 1, 2026 02:33
af89360 to
593b1e8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9989.
borg completion fishnow generates fish shell completions automatically, the same way bash/zsh completions are generated. borg brings its own fish backend rather than using shtab's (which appeared in shtab 1.9.0): shtab's fish backend bases its conditions on__fish_seen_subcommand_from(which can misfire when positional values collide with command names) and is not positional-aware. borg's generator walks the parser tree and emits fishcompletecommands, plus a preamble with fish versions of the same dynamic completion functions the bash/zsh scripts have (archive names,aid:archive IDs with metadata descriptions, tags, sort keys, files cache modes, compression specs, chunker params, relative time markers, timestamps, file sizes, help topics).Details:
shtab.SUPPORTED_SHELLSalready contains "fish" and is used as-is for the SHELL choices;borg completion fishdispatches to borg's own backend.key export) and the number of positional arguments already given, so completions are position-aware — e.g.borg diffoffers archive names for both the first and second positional, and file completion still works forPATHarguments after them.--keepis a flag inkey change-locationbut takes a value inprune; it is treated as value-taking (the lesser evil).scripts/shell_completions/fish/borg.fishand its test are removed.fish --no-execute) and, via fish'scomplete -C, subcommand/option/value completion, sort-key dedup, files-cache exclusivity, and archive name /aid:completion against a real repo (running the borg under test via a small PATH shim). CI already installs fish for completion tests.Upstream shtab work resulting from this evaluation (issues filed for each problem found in shtab's fish backend, plus fix PRs):
shtab.FILEoptions mis-complete: fish: no file completion; options marked shtab.FILE complete the wrong candidates tqdm/shtab#227%(default)sunexpanded, subcommand descriptions missing withhelp=-only: fish: %(default)s not expanded in descriptions; subcommands lack descriptions when only help= is set tqdm/shtab#231For now, borg ships its own fish backend so this doesn't have to wait on upstream. Once the shtab fixes are merged and released, we will adapt borg to use shtab's fish backend (like it already does for bash/zsh) and remove any then-duplicate fish code here.
🤖 Generated with Claude Code