-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
poetry.bash-completion has multiple syntax errors #4572
Comments
Attached the generated completion file with commented out lines. |
Hi, Can you add the version of bash you are using and how you installed Poetry and bash ? I have tested your file with bash 5.1.8 on High Sierra and it worked properly. |
$ bash --version
GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin18.6.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ pip list
Package Version
------------------ ---------
...
poetry 1.2.0a2
poetry-core 1.1.0a6 |
Updated bash to 5.1.8(1)-release. Re-ran the completion command and get this: $ source ~/.bashrc
-bash: /usr/local/etc/profile.d/poetry.bash-completion: line 40: syntax error near unexpected token `clear'
-bash: /usr/local/etc/profile.d/poetry.bash-completion: line 40: ` (cache clear)' |
Did you check the value of You have two options here:
For number 2, you need to add your brew bash path to the list of available shells in |
Good catch with Set both the absolute path in iTerm (login shell to custom shell) to the brew $ echo $BASH_VERSION
5.1.8(1)-release Re-ran $ source ~/.bashrc
-bash: /usr/local/etc/profile.d/poetry.bash-completion: line 40: syntax error near unexpected token `clear'
-bash: /usr/local/etc/profile.d/poetry.bash-completion: line 40: ` (cache clear)' |
From the looks of it, you did not install the Do that first and then put the poetry completion file under |
This is what I've been doing: $ poetry completions bash > /usr/local/etc/profile.d/poetry.bash-completion
$ ll /usr/local/etc/profile.d/poetry.bash-completion
-rw-r--r-- 1 lance.stephens admin 4.4K Oct 6 12:56 /usr/local/etc/profile.d/poetry.bash-completion
$ grep 'poetry.bash-completion' ~/.bashrc
. /usr/local/etc/profile.d/poetry.bash-completion
$ source ~/.bashrc
-bash: /usr/local/etc/profile.d/poetry.bash-completion: line 40: syntax error near unexpected token `clear'
-bash: /usr/local/etc/profile.d/poetry.bash-completion: line 40: ` (cache clear)' Which appears to be supported according to |
I'm getting the same issue here on Ubuntu using the exact same commands and when i try to run it as a bash script normally. I have updated my bash and bash-completions to no avail. The problem seems to be that completions for subcommands are written like (command subcommand)
opts="${opts} ..."
;; which isn't valid bash as far as i can tell. Separating the command and subcommand with a space doesn't seem to work. This only is a problem with |
I suspect this is an issue with |
This one still fails accross all platforms. $ poetry --version
Poetry (version 1.2.0b2dev0)
$ echo $BASH_VERSION
5.1.16(1)-release
$ poetry completions bash | bash
bash: line 40: syntax error near unexpected token `clear'
bash: line 40: ` (cache clear)' |
Can we reopen this issue as it is still a problem and the PR that was supposed to close it, did actually do it (see there)? |
@LordFckHelmchen AFAIK, it should affect future release. You probably have to compare release dates and when pull request with fix was accepted (or git log for that release). I've been ranging first too (because it looked like maintainers have closed an open issue), until I've read full discussion. And, as always, patches are welcome. Thanks to maintainers for the support. |
The poetry maintainers are playing whack-a-mole with duplicate tickets. Poetry users will probably keep creating more issues for this bug as long as the bug still exists in the latest version of poetry, and an open issue for the bug doesn't exist. Hand-waving at an upstream repo and closing all of the issues makes it extremely difficult to follow what's going on. Suggestion: leave 1 issue open for this bug in poetry and link it to the root cause issue in cleo. Edit: This issue might be a good one to use, since it's linked to the cleo PR |
I personally haven't looked at this issue for a minute (it merely lives in my 'common duplicates' doc) -- looks like it was closed by mistake as the Cleo PR should have specified Relates-To or similar. This shouldn't be closed in Poetry until after the Cleo release and subsequent bump of our constraint. |
If anyone wants working bash completion for poetry now, I created a gist: https://gist.github.com/raffraffraff/36b7a8cd1a4308150d7f843724a19ff9 I wanted an excuse to learn the poetry syntax, plus having decent shell completion makes learning it much easier. YMMV, but it's working great for me. It's able to complete commands, positional args and options, and even suggests package names, source names, config options and caches where appropriate (and I don't think the official shell completion will do that). |
@raffraffraff without pull request it will be lost in the internet for sure. (I have fixed completions with vim+macros in <1 min). |
@koutoftimer I didn't send a pull request because poetry uses cleo for bash completions, but my script is 'hand made'. I'm just sharing here in case it's useful to others. |
This is well-known and universal; please refrain from "me too" as it only adds noise and distracts the people trying to get Cleo 1.0 over the finish line so we can ship the (already merged) fix 😄 |
Completion bugs are now fixed with the incoming release. |
When is version 1.3.0 expected to be published? |
When it's ready/the maintainers have had time to finalize the changelog (including any late merges). |
If you go to the "watch" dropdown for this repository in the upper right corner of the page and click "custom", you can select to be notified of releases, which should send you an alert when 1.3.0 is published. |
Just wanted to close the loop here (know the issue is closed haha) — running bash 5.2.15 and poetry 1.3.2 appears to have resolved the completion errors after re-exporting the completion script via poetry completions bash > /usr/local/etc/profile.d/poetry.bash-completion Appreciate everyone's help 🙏 |
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. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: macOS 10.14.6 Mojave
Poetry version: Poetry (version 1.2.0a2)
Link of a Gist with the contents of your pyproject.toml file: N/A
Issue
Generated a completion file for bash via
poetry completions bash > /usr/local/etc/profile.d/poetry.bash-completion
due topoetry completions bash > /etc/bash_completion.d/poetry.bash-completion
not having the/etc/bash_completion.d
directory on Mac. Sourced in.bashrc
and wound up with a bunch of syntax errors that I had to comment out (i.e., not use.).bashrc
. /usr/local/etc/profile.d/poetry.bash-completion
/usr/local/etc/profile.d/poetry.bash-completion
Full poetry.bash-completion
The text was updated successfully, but these errors were encountered: