poetry.bash-completion (brew) calls not-existing function "__ltrim_colon_completions"
- [ x] I am on the latest Poetry version.
- [ x] I have searched the issues of this repo and believe that this is not a duplicate.
- [ x] If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption).
- OS version and name: macOS Big Sur 11.0.1
- Poetry version: 1.1.4
Issue
Hi, after
poetry completions bash > $(brew --prefix)/etc/bash_completion.d/poetry.bash-completion
source /usr/local/etc/bash_completion.d/poetry.bash-completion
and a restart of a shell I get
poetry shbash: __ltrim_colon_completions: command not found
when typing poetry sh and pressing the tab key for completion.
I looked into the file poetry.bash-completion and the code (lines 123 and 133) tries to call the not existing function __ltrim_colon_completions.
Thanks, Jamil
I think if you install bash-completion using MacPorts, then this will work, but it would be better if poetry did not require this. Also, it seems like the file should be called poetry.bash not poetry.bash-completion. The following worked for me:
port install bash-completion
sudo echo /opt/local/bin/bash >> /etc/shells
chsh -s /opt/local/bin/bash
mkdir -p ~/.local/share/bash-completion/completions
poetry completions bash > ~/.local/share/bash-completion/completions/poetry.bash
Then I added something like this to my .bashrc file:
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
. /opt/local/etc/profile.d/bash_completion.sh
fi
I would still advocate for providing a graceful fallback so poetry works without fail using the system shell.
Hope it helps.
brew install bash-completion
source $(brew --prefix)/etc/bash_completion
Same happened for me on Windows 10 with Git Bash for Windows setup.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.