Release 0.6.1 — bash completion fix for stock macOS bash 3.2#29
Merged
Conversation
Stock macOS /bin/bash is 3.2.57. bash-completion@2 requires bash 4+ and silently bails on 3.2, so completions/xsh.bash's first line — _init_completion || return — exited silently and tab-completion did nothing. Three coordinated changes make tab-completion work out of the box on stock macOS: 1. completions/xsh.bash: define a minimal _init_completion shim if not already present. Guarded so a real bash-completion load (now or later) wins. Defensive cword<=0 guard matches real _init_completion semantics and avoids bash 3.2's bad-array-subscript error on COMP_WORDS[-1]. 2. .xshrc: auto-source the completion file. Reaches every bash user without requiring them to edit ~/.bash_profile or rely on /etc/bash_completion.d discovery (which doesn't exist on stock macOS). 3. install.sh: drop the now-redundant /etc/bash_completion.d/xsh copy. It was a no-op on macOS (no such dir) and double-sourced on Linux once .xshrc auto-source landed. Verified on /bin/bash 3.2.57 with no bash-completion installed: 19 built-in completions + 'xsh load <TAB>' → 3 known public libs. Also verified that a pre-existing _init_completion is preserved (the shim doesn't override). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Fixes the 0.6.0 tab-completion regression on stock macOS bash 3.2 (no bash-completion package required) and notes the spec correction from PR #26. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #29 +/- ##
==========================================
+ Coverage 63.13% 63.29% +0.15%
==========================================
Files 3 3
Lines 792 790 -2
==========================================
Hits 500 500
+ Misses 292 290 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
Patch release fixing the 0.6.0 tab-completion regression on stock macOS bash 3.2.
What's in 0.6.1
Fixed
bash-completion. The 0.6.0 script depended on_init_completionfrombash-completion@2which silently bails on bash 3.2. Now ships a self-contained fallback shim, guarded so a real bash-completion load (now or later) still wins..xshrcauto-sources the completion file — no need to touch~/.bash_profileor/etc/bash_completion.d/.Removed
install.shno longer copies to/etc/bash_completion.d/(redundant after.xshrcauto-source; was a no-op on macOS anyway).Changed
__xsh_get_util_by_pathPendingtest in 0.6.0 was based on a wrong assumption about selector encoding. xsh-lib/core uses plain-numeric filenames inside util directories (e.g.string/repeat/{1..8}.sh), not basename prefixes like2-upper.sh. Existing implementation was correct; test replaced with a passing assertion of the real convention.Why MINOR doesn't bump
Per SemVer pre-1.0: bug fixes → PATCH. No API changes, no removed features (just CI/installer cleanup).
Test plan
0.6.1→release.ymlauto-creates GitHub release from CHANGELOG.mdbash install.sh -f -s(orxsh upgrade)🤖 Generated with Claude Code