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_completion issue: solved #6577

Closed
3 of 4 tasks
consultit opened this issue Sep 21, 2022 · 3 comments
Closed
3 of 4 tasks

bash_completion issue: solved #6577

consultit opened this issue Sep 21, 2022 · 3 comments
Labels
status/duplicate Duplicate issues

Comments

@consultit
Copy link

  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I've installed poetry:

curl -sSL https://install.python-poetry.org | python3 -

Then I've enabled bash completion:

poetry completions bash >> ~/.bash_completion

But there were several issues when starting bash session:

...
bash: /home/ubuntu/.bash_completion: line 168: syntax error near unexpected token `show'
bash: /home/ubuntu/.bash_completion: line 168: `            (source show)'
...

Then I've quoted multi-word items inside case statement, e.g.:

...
            ("source show")
            opts="${opts} "
            ;;
...

and the problem was solved.

@consultit consultit added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 21, 2022
@neersighted neersighted added status/duplicate Duplicate issues and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 21, 2022
@neersighted
Copy link
Member

Duplicate #6543, #6523, #6486, #6465, #6446, #6384, #4572, python-poetry/cleo#133,

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Sep 21, 2022
@welrbraga
Copy link

welrbraga commented Oct 28, 2022

Same here, but solved with @consultit tip. Really thanks, guy.

OS version:
cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
[...]

Bash version:
echo $BASH_VERSION
5.1.16(1)-release

Default Python Version
python --version
Python 3.10.6

Python 3 Version
python3 --version
Python 3.10.6

Poetry Version
poetry --version
Poetry (version 1.2.2)

Poetry completions install
poetry completions >~/.bash_completion

Poetry completions loading
. /home/wbraga/.bash_completion
bash: /home/wbraga/.bash_completion: linha 40: erro de sintaxe próximo ao token inesperado clear'
bash: /home/wbraga/.bash_completion: linha 40: (cache clear)'

Like @consultit said, but all mutiword option in quotes, solved (maybe temporary, I don't know). The options was found with this regex in a grep command line:
grep -E ' \(([a-z]* [a-z]*)( [a-z]*)?\)' ~/.bash_completion
(cache clear)
(cache list)
(debug info)
(debug resolve)
(env info)
(env list)
(env remove)
(env use)
(self add)
(self install)
(self lock)
(self remove)
(self show)
(self show plugins)
(self update)
(source add)
(source remove)
(source show)

And a temporary solution for me was parse the poetry output (or the .bash_completion file) in a sed command and quoting all multiword options, like that:

sed -i.bk -E 's@ \(([a-z]* [a-z]*)( [a-z]*)?\)@ ("\1\2")@g' ~/.bash_completion

Of course, I could simply edit my .bash_completion manually.

Copy link

github-actions bot commented Mar 1, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

3 participants