Skip to content

fix(completions): the PowerShell completion offers an invalid --wrap value - #4070

Merged
keith-hall merged 5 commits into
sharkdp:masterfrom
ump45nose:ps1-completion-wrap-auto
Nov 2, 2026
Merged

keith-hall merged 5 commits into
sharkdp:masterfrom
ump45nose:ps1-completion-wrap-auto

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

The PowerShell completion offers always for --wrap, but --wrap has no always mode:

$ArrayWrap       = @('always', 'never', 'character', 'word')   # assets/completions/_bat.ps1.in:12

src/bin/bat/clap_app.rs:228 parses that argument as

.value_parser(["auto", "never", "character", "word"])
.default_value("auto")

so tab-completing and accepting the first suggestion gives you bat: invalid value 'always' for '--wrap <mode>'.

auto is also what every other place in the repo says: the same file describes the flag as (*auto*, never, character, word) at _bat.ps1.in:143, and bat.bash.in:120, bat.zsh.in:37 and bat.fish.in:117-122 all list auto never character word. $ArrayWrap is used only for --wrap (_bat.ps1.in:73-74), so nothing else changes.

One value fixed. --wrap=never is already covered by the --chop-long-lines description at line 161, so never stays where it is.

Per CONTRIBUTING, no changelog entry: this is a completion-script description typo, not a change to bat's behaviour — the require-changelog-for-PRs workflow will complain and can be disregarded as described in CONTRIBUTING.md:26-30. Happy to add an entry under Bugfixes if you'd rather have one.

AI assistance: an AI assistant helped spot the mismatch and draft this text; I verified each cited line myself and the change is one string in a completion file.

I could not exercise the completion here (no cargo build, no pwsh in this environment), so the fix is verified by source comparison only.

@agammann agammann 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.

I exercised the PowerShell completion on this head. After substituting the executable placeholder, TabExpansion2 for bat --wrap offers auto, character, never, and word. The same check on master offers always instead of auto; the new set matches the four values accepted by the --wrap parser in clap_app.rs. The changelog entry describes the behavior accurately. This fixes the completion mismatch for me.

@keith-hall
keith-hall enabled auto-merge November 2, 2026 12:52
@keith-hall
keith-hall merged commit 0db13cb into sharkdp:master Nov 2, 2026
24 checks passed
cindykrafft pushed a commit to cindykrafft/bat that referenced this pull request Nov 2, 2026
Brings in sharkdp#4038, sharkdp#4048 and sharkdp#4070. The merge of sharkdp#4048 re-added the old
UTF-16BE CHANGELOG entry with its "#XXXX" placeholder at the top of
Bugfixes, so drop that duplicate; the entry this PR corrects to sharkdp#4076
stays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VVn4SeAXPsUajXT2rtHQfo
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.

3 participants