-
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
bash completion has syntax errors #6486
Comments
I see a few issues with the completion code. First, bash case "$com" in
(about)
opts="${opts} "
;; Should be case "$com" in
about)
opts="${opts} "
;; Secondly, and a bigger problem to solve, the comparisons being made in the case statement are trying to compare multiple words when only one word is being checked. This is a problem both syntactically and in terms of how the code is structured.
That code is syntactically invalid because there is unquoted whitespace in it. #!/usr/bin/env bash
# cat example-1.sh
case "$1" in
"cache clear")
echo "1 is $1"
;;
*)
echo "default target"
;;
esac
So the way this needs to be structured is to check each word individually, then any more words beyond that one, in a tree structure of completions rather than a flat list of possible completions: #!/usr/bin/env bash
# example-2.sh
case "$1" in
cache)
echo "1 is $1"
case "$2" in
clear)
echo "2 is $2"
;;
*)
echo "default cache target"
;;
esac
;;
*)
echo "default target"
;;
esac
|
duplicate #4572, and the several other duplicates linked from that |
As mentioned in the previous comment, it's a duplicate. What's more, a fix was made upstream in |
My bad. This search didn't turn up any of the duplicates or #4572 "https://github.com/python-poetry/poetry/issues?q=is%3Aissue+is%3Aopen+%22cache+clear%22+%22completion%22" |
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: raspios, macos
Poetry version: 1.2.0
Link of a Gist with the contents of your pyproject.toml file: N/A, this is just for the completion code
Bash versions tested:
Issue
poetry completions bash
generates syntactically incorrect bash code.Steps to reproduce
The text was updated successfully, but these errors were encountered: