alacritty/alacritty

-bash: complete: nosort: invalid option name sourcing alacritty.bash completion file on MacOS

diogomatsubara opened this issue · 3 comments

In commit 59c63d3, the bash complete script (alacritty.bash) was changed and includes in line 368 the -o nosort option. Unfortunately that option is not available in the default bash shell shipped by MacOS (3.2.57(1)-release) and I end up getting the following message when I source the file:

-bash: complete: nosort: invalid option name

For example, projects that use the go-lang cobra command to generate the completion file (e.g. yq) take into account the bash version to enable or not the nosort option (see https://github.com/spf13/cobra/blob/v1.8.0/bash_completionsV2.go#L120-L130).

It'd be nice to have a similar logic in alacritty.bash to avoid this error.

System

OS: macOS 14.4.1 (23E224)
Version: alacritty 0.13.2 (bb8ea18)
Bash: 3.2.57(1)-release

Logs

To reproduce source the alacritty.bash on MacOS with bash 3.2.57(1)-release

$ . alacritty.bash
-bash: complete: nosort: invalid option name

@chrisduerr I'm pretty sure this part of completions is also auto generated, thus it should be brought to clap?

It should likely do a version check or something and not emit the option by default. Though, macOS users better just install bash from e.g. brew, because apple don't generally care about gplv3 stuff and not sure they even security bug fix it.

@kchibisov thanks for the quick reply!

It seems this was fixed in clap more recent version 4.5.4 clap-rs/clap@2b48858 but alacritty uses 4.4.11 (https://github.com/alacritty/alacritty/blob/master/Cargo.lock#L349)

If only macOS would actually update their software…