Skip to content
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 complains of a missing compopt command #1464

Closed
aalmiray opened this issue Nov 14, 2021 · 2 comments
Closed

Bash complains of a missing compopt command #1464

aalmiray opened this issue Nov 14, 2021 · 2 comments
Labels
theme: auto-completion An issue or change related to auto-completion theme: compatibility Issues related to binary and source backwards compatibility theme: shell An issue or change related to interactive (JLine) applications type: enhancement ✨
Milestone

Comments

@aalmiray
Copy link
Contributor

I've got the following output every time I press after generating the completion script using the default AutoComplete subcommand from PicoCLI 4.6.2:

-bash: compopt: command not found
$ echo $BASH_VERSION
3.2.57(1)-release

$uname -a
Darwin aalmiray2.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64

Apparently compopt is an alias for complete that's added only if $ZSH_VERSION is set, however the functions applied for Bash will still call that alias.

@remkop remkop added the theme: auto-completion An issue or change related to auto-completion label Nov 15, 2021
@remkop remkop added this to the 4.6.3 milestone Nov 15, 2021
@remkop remkop added theme: compatibility Issues related to binary and source backwards compatibility type: enhancement ✨ labels Nov 15, 2021
@remkop
Copy link
Owner

remkop commented Nov 15, 2021

Ok, interesting. Apparently the shell builtin compopt is not available on the outdated bash version 3.2.57 that ships with Mac OS.

I found a nice suggestion here to replace compopt +o default with this:

type compopt &>/dev/null && compopt +o default

I will fix that in the next release of picocli.

Meanwhile, you can ask your users to run the following command (or make it part of the installation):

sed -i 's/compopt +o default/type compopt &>/dev/null && compopt +o default/g' path/to/completion_script

Would that work?

@remkop remkop added the theme: shell An issue or change related to interactive (JLine) applications label Dec 8, 2021
@remkop remkop closed this as completed in abd0180 Jan 18, 2022
@remkop
Copy link
Owner

remkop commented Jan 18, 2022

I committed the fix described above.
If you have any feedback that would be great. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: auto-completion An issue or change related to auto-completion theme: compatibility Issues related to binary and source backwards compatibility theme: shell An issue or change related to interactive (JLine) applications type: enhancement ✨
Projects
None yet
Development

No branches or pull requests

2 participants