-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bash completion emits error about invalid nosort option #5190
Comments
Completions are mostly community maintained on a best-effort. If there is a reasonable way to skip |
Thanks for the quick response. The bash version is accessible with the - complete -F _{name} -o nosort -o bashdefault -o default {name}
+ if [ ${BASH_VERSINFO[0]} -ge 4 ]; then
+ complete -F _{name} -o nosort -o bashdefault -o default {name}
+ else
+ complete -F _{name} -o bashdefault -o default {name}
+ fi would be good enough. |
It was added in bash 4.4, checking >= 4 isn't enough |
Whats the likelihood someone is using <4.4 who isn't on Mac and using v3? |
@epage I think CentOS 7 uses Bash 4.2, which is one of the platforms that led to sharkdp/fd#1407. A fully correct check is not too hard, something like major=${BASH_VERSINFO[0]}
minor=${BASH_VERSINFO[1]}
if ((major > 4 || (major == 4 && minor >= 4))); then
complete -F _{name} -o nosort -o bashdefault -o default {name}
else
complete -F _{name} -o bashdefault -o default {name}
fi |
FYI, I just hit this on a supercomputing cluster (via fd) which is rocking SLES12 and:
So, yeah, old OSs and old bashes live out there. Though I'm apparently right at the edge :) (NOTE: Soon we will move to SLES15 and be closer to modern day.) |
Ouch :) Enjoy the upgrade! |
(btw to be clear, a PR fixing this from anyone would be welcome) |
Please complete the following tasks
Rust Version
rustc 1.73.0 (cc66ad468 2023-10-03)
Clap Version
ruff
package version0.0.292
which specifiesclap = { version = "4.4.7", features = ["derive"] }
Minimal reproducible code
not relevant
Steps to reproduce the bug with the above code
brew install ruff
and somewhere in your
.bash_profile
or.bashrc
Actual Behaviour
When I open a new shell, the following error message is displayed
Expected Behaviour
No error message should be displayed.
Additional Context
Hello beautiful
clap
people. I come from this issue with theruff
package (plugin ? crate ? I'm not a rust person). I'll say here again the issue I described there :ruff
(which relies onclap
) installed throughhomebrew
bash_completions
for the installed homebrew packages (see Steps to reproduce above)Presumably, the issue is that the
nosort
option is supported starting from bash v4 only, while macOS still uses bash v3. See this comment by @zanieb which locates where this happens inclap
.I'm not sure if this is a bug or if
clap
is not trying to support old bash versions. Again I'm not aclap
nor even a rust user.Debug Output
No response
The text was updated successfully, but these errors were encountered: