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

Fish completions raise errors but still works #437

Open
3 tasks done
AxZxP opened this issue Jun 29, 2022 · 46 comments · Fixed by #247
Open
3 tasks done

Fish completions raise errors but still works #437

AxZxP opened this issue Jun 29, 2022 · 46 comments · Fixed by #247

Comments

@AxZxP
Copy link

AxZxP commented Jun 29, 2022

  • 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).
  • macOS 10.15.7:
  • 1.2.0b2:
  • fish 3.5:

Issue

I installed the completions as explained in the doc, and completions are working. But there is an error when triggering autocomplete with TAB key :

~/.config/fish/completions/poetry.fish (line 57):
complete -c poetry -f -n '__fish_poetry_e3d63c4129b80bf7_complete_no_subcommand' -a source show -d 'Show information about sources configured for the project.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

I put the last error only, but the console print this error for almost every line of this file.

Screencast if needed
poetry-fish-completions.mp4
@jfroy
Copy link

jfroy commented Sep 4, 2022

The -a flag takes a single string argument. The completions emitted by poetry need to quote the argument to -a.

For example, -a "source show".

@Secrus
Copy link
Member

Secrus commented Sep 4, 2022

This is known and I am working on fixing completions in cleo right now.

@neersighted
Copy link
Member

Please feel free to open a Cleo bug and link back here.

@Dragon1573
Copy link

Summary

The problem still exists, but it only occurs when Poetry autocompletion is activated for the first time.

Environments

image

Steps to reproduce

image

image


How should I fix this problem? Shall I upgrade poetry to a preview version? Or just simply edit
and fix ~/.config/fish/completions/poetry.fish as follows on our own?

Click to expand
# commands
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'about' -d 'Shows information about Poetry.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'add' -d 'Adds a new dependency to pyproject.toml.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'build' -d 'Builds a package, as a tarball and a wheel by default.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'cache clear' -d "Clears Poetry's cache."
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'cache list' -d "List Poetry's caches."
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'check' -d 'Checks the validity of the pyproject.toml file.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'config' -d 'Manages configuration settings.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'debug info' -d 'Shows debug information.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'debug resolve' -d 'Debugs dependency resolution.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'env info' -d 'Displays information about the current environment.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'env list' -d 'Lists all virtualenvs associated with the current project.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'env remove' -d 'Remove virtual environments associated with the project.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'env use' -d 'Activates or creates a new virtualenv for the current project.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'export' -d 'Exports the lock file to alternative formats.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'help' -d 'Displays help for a command.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'init' -d 'Creates a basic pyproject.toml file in the current directory.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'install' -d 'Installs the project dependencies.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'list' -d 'Lists commands.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'lock' -d 'Locks the project dependencies.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'new' -d 'Creates a new Python project at <path>.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'publish' -d 'Publishes a package to a remote repository.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'remove' -d 'Removes a package from the project dependencies.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'run' -d 'Runs a command in the appropriate environment.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'search' -d 'Searches for packages on remote repositories.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'self add' -d "Add additional packages to Poetry's runtime environment."
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'self install' -d 'Install locked packages (incl. addons) required by this Poetry installation.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'self lock' -d "Lock the Poetry installation's system requirements."
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'self remove' -d "Remove additional packages from Poetry's runtime environment."
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'self show' -d "Show packages from Poetry's runtime environment."
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'self show plugins' -d 'Shows information about the currently installed plugins.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'self update' -d 'Updates Poetry to the latest version.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'shell' -d 'Spawns a shell within the virtual environment.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'show' -d 'Shows information about packages.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'source add' -d 'Add source configuration for project.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'source remove' -d 'Remove source configured for the project.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'source show' -d 'Show information about sources configured for the project.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'update' -d 'Update the dependencies as according to the pyproject.toml file.'
complete -c poetry -f -n '__fish_poetry_b892c35f425489c6_complete_no_subcommand' -a 'version' -d 'Shows the version of the project or bumps it when a valid bump rule is provided.'

@neersighted
Copy link
Member

The Cleo release has not made it into Poetry yet -- @Secrus is working on getting a release out this week. Due to neglect/bit rot, Cleo is in a pretty rough state release-wise and is difficult to release. The hope is to reset the board here (and there has been a lot of work to that end) so Cleo can release early and often with Poetry's needs.

@Dragon1573
Copy link

Now I get it. I'll try to edit ~/.config/fish/completions/poetry.fish as a walkaround.

After the patch is released in Cleo and applied to Poetry, I should remove my own poetry.fish and re-generate one for an "official fix"?

@Secrus
Copy link
Member

Secrus commented Oct 12, 2022

Now I get it. I'll try to edit ~/.config/fish/completions/poetry.fish as a walkaround.

After the patch is released in Cleo and applied to Poetry, I should remove my own poetry.fish and re-generate one for an "official fix"?

If everything goes according to our plan, update for Cleo should be a part of next minor release of Poetry (1.3 at the moment of writing this). The info will be in the release notes for sure and it will state the need for re-generation of completion files

@neersighted
Copy link
Member

Damn, closed by mistake as well.

@Secrus
Copy link
Member

Secrus commented Nov 22, 2022

Completion bugs are now fixed with the incoming release.

@Secrus Secrus closed this as completed Nov 22, 2022
@nbys
Copy link

nbys commented Dec 11, 2022

I still get an error using autocomplete in fish.

Poetry (version 1.3.0)
fish, version 3.5.1

log
poetry addcomplete: too many arguments

~/.config/fish/completions/poetry.fish (line 83):
complete -c poetry -A -n '__fish_seen_subcommand_from 'cache clear'' -l all -d 'Clear all entries in the cache.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 97):
complete -c poetry -A -n '__fish_seen_subcommand_from 'debug resolve'' -l extras -d 'Extras to activate for the dependency.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 98):
complete -c poetry -A -n '__fish_seen_subcommand_from 'debug resolve'' -l install -d 'Show what would be installed for the current system.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 99):
complete -c poetry -A -n '__fish_seen_subcommand_from 'debug resolve'' -l python -d 'Python version(s) to use for resolution.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 100):
complete -c poetry -A -n '__fish_seen_subcommand_from 'debug resolve'' -l tree -d 'Display the dependency tree.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 103):
complete -c poetry -A -n '__fish_seen_subcommand_from 'env info'' -l path -d 'Only display the environment\'s path.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 106):
complete -c poetry -A -n '__fish_seen_subcommand_from 'env list'' -l full-path -d 'Output the full paths of the virtualenvs.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 109):
complete -c poetry -A -n '__fish_seen_subcommand_from 'env remove'' -l all -d 'Remove all managed virtual environments associated with the project.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 180):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self add'' -l allow-prereleases -d 'Accept prereleases.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 181):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self add'' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 182):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self add'' -l editable -d 'Add vcs/path dependencies as editable.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 183):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self add'' -l extras -d 'Extras to activate for the dependency.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 184):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self add'' -l source -d 'Name of the source to use to install the package.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 187):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self install'' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 188):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self install'' -l sync -d 'Synchronize the environment with the locked packages and the specified groups.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 191):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self lock'' -l check -d 'Check that the poetry.lock file corresponds to the current version of pyproject.toml.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 192):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self lock'' -l no-update -d 'Do not update locked versions, only refresh lock file.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 195):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self remove'' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 198):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self show'' -l addons -d 'List only add-on packages installed.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 199):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self show'' -l latest -d 'Show the latest version.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 200):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self show'' -l outdated -d 'Show the latest version but only for packages that are outdated.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 201):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self show'' -l tree -d 'List the dependencies as a tree.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 206):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self update'' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 207):
complete -c poetry -A -n '__fish_seen_subcommand_from 'self update'' -l preview -d 'Allow the installation of pre-release versions.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 223):
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l default -d 'Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 224):
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l secondary -d 'Set this source as secondary.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)

riton referenced this issue in riton/cleo Dec 12, 2022
* This triggers a bug in 'fish completion' script as described in https://github.com/python-poetry/poetry/issues/5929#issuecomment-1345580021
* Also adapt bash, zsh and fish sample output
Secrus referenced this issue Dec 12, 2022
* This triggers a bug in 'fish completion' script as described in https://github.com/python-poetry/poetry/issues/5929#issuecomment-1345580021
* Also adapt bash, zsh and fish sample output
@Jubijub
Copy link

Jubijub commented Dec 12, 2022

I still get an error using autocomplete in fish.

Poetry (version 1.3.0) fish, version 3.5.1

log

+1, same issue (and same log) with Poetry 1.3.1 and Fish 3.5.1

@garbelini
Copy link

The last fix introduced a new issue but now it's too much quoting.

As a workaround search the the output for instances like '__fish_seen_subcommand_from 'self add'' and remove the extra quotes '__fish_seen_subcommand_from self add

Seems to work for me

@Dragon1573
Copy link

The last fix introduced a new issue but now it's too much quoting.

@neersighted @Secrus I think this issue should be re-open and fix again.


@garbelini Nice friend! Thank you for you solution. It also works for me.

I'm currently using NeoVim as my editor. I used the following command to quickly replace all these extra-quoted commands. It may also valid in Vim.

:1,$s/__fish_seen_subcommand_from '\(.*\)''/__fish_seen_subcommand_from \1'

@oschrenk
Copy link

Poetry (version 1.3.1)
fish, version 3.5.1

/usr/local/share/fish/vendor_completions.d/poetry.fish (line 223):
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l default -d 'Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources.'
^
from sourcing file /usr/local/share/fish/vendor_completions.d/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

/usr/local/share/fish/vendor_completions.d/poetry.fish (line 224):
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l secondary -d 'Set this source as secondary.'
^
from sourcing file /usr/local/share/fish/vendor_completions.d/poetry.fish

(just pasting last few lines)

Thanks @garbelini for the workaround, and @Dragon1573 for making it easy to fix!

@drin
Copy link

drin commented Jan 10, 2023

I still see this issue with poetry 1.3.1 and fish 3.6.0 on macosx using homebrew. I'll see if I can submit a follow-up PR (if there isn't already one) in the next day or so.

@purew
Copy link

purew commented Jan 24, 2023

I see this issue on poetry 1.3.2 on Archlinux

~/.config/fish/completions/poetry.fish (line 223):
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l default -d 'Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 224):
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l secondary -d 'Set this source as secondary.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
                                                             version
$
$ poetry -V
Poetry (version 1.3.2)
$ fish -V
fish: invalid option -- 'V'
$ (1) fish -v
fish, version 3.6.0

@scarf005
Copy link

scarf005 commented Jan 25, 2023

I suggest to re-open the issue, as this issue still persists:

(100 more above)
~/.config/fish/completions/poetry.fish (line 223): 
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l default -d 'Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources.'
^
from sourcing file ~/.config/fish/completions/poetry.fish

(Type 'help complete' for related documentation)
complete: too many arguments

~/.config/fish/completions/poetry.fish (line 224): 
complete -c poetry -A -n '__fish_seen_subcommand_from 'source add'' -l secondary -d 'Set this source as secondary.'
^
from sourcing file ~/.config/fish/completions/poetry.fish
$ poetry --version
Poetry (version 1.3.2)
$ fish --version
fish, version 3.6.0
$ uname -a
Linux TG02 5.15.0-58-generic python-poetry/poetry#64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

@qbedard
Copy link

qbedard commented Jan 30, 2023

Yep. Poetry 1.3.2 and Fish 3.6.0 here and seeing the same issue.

@dancju
Copy link

dancju commented Feb 3, 2023

I edited ~/.config/fish/completions/poetry.fish and sorted out mismatched single and double quotes. Now this issue is gone.

  • Fish 3.6.0
  • Python 3.11
  • Poetry 1.3.2

@Secrus Secrus reopened this Feb 3, 2023
@Secrus
Copy link
Member

Secrus commented Feb 3, 2023

The issue is now reopened. Please refrain from "me too" type of comments.

@drin
Copy link

drin commented Feb 3, 2023

since I haven't actually done the fix, I can share some specific things I've looked at.

completions_command.py#L231-L233 seems like it should be sanitizing a string correctly for substitution on line 258.

The regex provided by @Dragon1573 makes it seem like line 258 is the clear culprit of output strings being generated incorrectly.

The test file also seems like it should be correct: completion/fixtures/fish.txt#L40

so, I'm not actually sure what change to make.

Edit: removed source since it's not relevant (see comments below)

@vkravets
Copy link

vkravets commented Mar 3, 2023

At Fish 3.6.0 at complete there is no option -A

from 2.5b1

complete no longer recognises --authoritative and --unauthoritative options, and they are marked as obsolete.

@oliverandrich
Copy link

It is still a problem with Poetry 1.4.0 and fish 3.6.0. The problem seems to be that the quoting for the complex commands like "self update" is mangled. I could fix the problem by removing all these quotes around "self update", "self add", ...

CleanShot 2023-03-18 at 08 51 40@2x

@drin
Copy link

drin commented Mar 18, 2023

It is still a problem with Poetry 1.4.0 and fish 3.6.0.

I believe poetry 1.4.0 still uses cleo 2.0.1, see my above comment.

the 1.4 branch still has cleo 2.0.1 in its poetry.lock file

@drin
Copy link

drin commented Mar 21, 2023

I'll try to request that cleo get a new release, I'm not sure what the process is for it so I just asked in the discord for now. Will update this comment as appropriate.

@oliverandrich
Copy link

Thanks, @drin. I installed a fixed version of the fish completion file in my user config and wait for the update to come.

@drin
Copy link

drin commented Mar 27, 2023

btw when I asked last week, the response was that cleo maintainers have some bugs they want to fix before they release. I do not know what the bugs are, so I guess there's not much to do.

@phsb5321
Copy link

phsb5321 commented Apr 4, 2023

Hey, is there any updates related to this issue ?

@MalayAgr
Copy link

MalayAgr commented Apr 5, 2023

Still facing this issue. Any updates and/or solutions?

@drin
Copy link

drin commented Apr 5, 2023

I don't think this issue needs any more updates.

After the next cleo release it will be fixed and otherwise there are a variety of suggestions in the comments for short-term workarounds.

You can check in the poetry discord to see if there's anything you can do to help with release

@sersorrel
Copy link

the conversation alluded to above:

image

since then there have been essentially no messages in the #cleo channel.

in 2022, there was a post stating that "Cleo was quite neglected for some time, we are now getting it back in shape"; it's unfortunate that this doesn't seem to have had any user-visible impact

@Secrus
Copy link
Member

Secrus commented Apr 6, 2023

It takes time, to do things right. At the moment, I am the only person actively working on Cleo maintenance. Everybody on the Poetry team is working on this project as a volunteer, giving it as much of our free time as we can. I understand the frustration when things don't work as intended, but please have patience.

@rahul286
Copy link

rahul286 commented Apr 7, 2023

On macOS, the following appears to be working for me.

sed -i.bak -E "s/'([a-z]*[[:blank:]][a-z]*)''/\1'/g" /opt/homebrew/share/fish/vendor_completions.d/poetry.fish

Please note that I use GNU sed (can be installed using brew install gnu-sed. if you do this, read post-install caveats)

@samof76
Copy link

samof76 commented Apr 7, 2023

@rahul286 thanks

Its worked for me on linux as well...

sed -i.bak -E "s/'([a-z]*[[:blank:]][a-z]*)''/\1'/g" ~/.config/fish/completions/poetry.fish

@iRomanyshyn
Copy link

Hi! The issue is still there.

@Larandar
Copy link

Larandar commented May 3, 2023

For my fellow sd users the following work and is easier:

poetry completions | sd "'([^']+)''" '"$1"\'' > ~/.config/fish/completions/poetry.fish

Contrary to what some earlier regex were looking for, the only problem is double quoting in the same argument ('[^']+'')

@Asseel-Naji
Copy link

For anyone just looking for the file, here you go:
Valid on poetry 1.5.1

~/.config/fish/completions/poetry.fish

function __fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand
    for i in (commandline -opc)
        if contains -- $i about add build 'cache clear' 'cache list' check config 'debug info' 'debug resolve' 'env info' 'env list' 'env remove' 'env use' export help init install list lock new publish remove run search 'self add' 'self install' 'self lock' 'self remove' 'self show' 'self show plugins' 'self update' shell show 'source add' 'source remove' 'source show' update version
            return 1
        end
    end
    return 0
end

# global options
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l ansi -d 'Force ANSI output.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l directory -d 'The working directory for the Poetry command (defaults to the current working directory).'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l help -d 'Display help for the given command. When no command is given display help for the list command.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l no-ansi -d 'Disable ANSI output.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l no-cache -d 'Disables Poetry source caches.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l no-interaction -d 'Do not ask any interactive question.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l no-plugins -d 'Disables plugins.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l quiet -d 'Do not output any message.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l verbose -d 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.'
complete -c poetry -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -l version -d 'Display this application version.'

# commands
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a about -d 'Shows information about Poetry.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a add -d 'Adds a new dependency to pyproject.toml.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a build -d 'Builds a package, as a tarball and a wheel by default.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'cache clear' -d 'Clears a Poetry cache by name.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'cache list' -d 'List Poetry\'s caches.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a check -d 'Checks the validity of the pyproject.toml file.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a config -d 'Manages configuration settings.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'debug info' -d 'Shows debug information.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'debug resolve' -d 'Debugs dependency resolution.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'env info' -d 'Displays information about the current environment.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'env list' -d 'Lists all virtualenvs associated with the current project.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'env remove' -d 'Remove virtual environments associated with the project.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'env use' -d 'Activates or creates a new virtualenv for the current project.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a export -d 'Exports the lock file to alternative formats.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a help -d 'Displays help for a command.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a init -d 'Creates a basic pyproject.toml file in the current directory.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a install -d 'Installs the project dependencies.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a list -d 'Lists commands.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a lock -d 'Locks the project dependencies.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a new -d 'Creates a new Python project at <path>.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a publish -d 'Publishes a package to a remote repository.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a remove -d 'Removes a package from the project dependencies.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a run -d 'Runs a command in the appropriate environment.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a search -d 'Searches for packages on remote repositories.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'self add' -d 'Add additional packages to Poetry\'s runtime environment.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'self install' -d 'Install locked packages (incl. addons) required by this Poetry installation.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'self lock' -d 'Lock the Poetry installation\'s system requirements.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'self remove' -d 'Remove additional packages from Poetry\'s runtime environment.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'self show' -d 'Show packages from Poetry\'s runtime environment.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'self show plugins' -d 'Shows information about the currently installed plugins.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'self update' -d 'Updates Poetry to the latest version.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a shell -d 'Spawns a shell within the virtual environment.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a show -d 'Shows information about packages.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'source add' -d 'Add source configuration for project.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'source remove' -d 'Remove source configured for the project.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a 'source show' -d 'Show information about sources configured for the project.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a update -d 'Update the dependencies as according to the pyproject.toml file.'
complete -c poetry -f -n '__fish_poetry_8d3a3a77ea0412bb_complete_no_subcommand' -a version -d 'Shows the version of the project or bumps it when a valid bump rule is provided.'

# command options

# about

# add
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l allow-prereleases -d 'Accept prereleases.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l dev -d 'Add as a development dependency. (Deprecated) Use --group=dev instead.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l editable -d 'Add vcs/path dependencies as editable.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l extras -d 'Extras to activate for the dependency.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l group -d 'The group to add the dependency to.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l lock -d 'Do not perform operations (only update the lockfile).'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l optional -d 'Add as an optional dependency.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l platform -d 'Platforms for which the dependency must be installed.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l python -d 'Python version for which the dependency must be installed.'
complete -c poetry -A -n '__fish_seen_subcommand_from add' -l source -d 'Name of the source to use to install the package.'

# build
complete -c poetry -A -n '__fish_seen_subcommand_from build' -l format -d 'Limit the format to either sdist or wheel.'

# 'cache clear'
complete -c poetry -A -n '__fish_seen_subcommand_from "cache clear"' -l all -d 'Clear all entries in the cache.'

# 'cache list'

# check

# config
complete -c poetry -A -n '__fish_seen_subcommand_from config' -l list -d 'List configuration settings.'
complete -c poetry -A -n '__fish_seen_subcommand_from config' -l local -d 'Set/Get from the project\'s local configuration.'
complete -c poetry -A -n '__fish_seen_subcommand_from config' -l unset -d 'Unset configuration setting.'

# 'debug info'

# 'debug resolve'
complete -c poetry -A -n '__fish_seen_subcommand_from "debug resolve"' -l extras -d 'Extras to activate for the dependency.'
complete -c poetry -A -n '__fish_seen_subcommand_from "debug resolve"' -l install -d 'Show what would be installed for the current system.'
complete -c poetry -A -n '__fish_seen_subcommand_from "debug resolve"' -l python -d 'Python version(s) to use for resolution.'
complete -c poetry -A -n '__fish_seen_subcommand_from "debug resolve"' -l tree -d 'Display the dependency tree.'

# 'env info'
complete -c poetry -A -n '__fish_seen_subcommand_from "env info"' -l executable -d 'Only display the environment\'s python executable path.'
complete -c poetry -A -n '__fish_seen_subcommand_from "env info"' -l path -d 'Only display the environment\'s path.'

# 'env list'
complete -c poetry -A -n '__fish_seen_subcommand_from "env list"' -l full-path -d 'Output the full paths of the virtualenvs.'

# 'env remove'
complete -c poetry -A -n '__fish_seen_subcommand_from "env remove"' -l all -d 'Remove all managed virtual environments associated with the project.'

# 'env use'

# export
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l dev -d 'Include development dependencies. (Deprecated)'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l extras -d 'Extra sets of dependencies to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l format -d 'Format to export to. Currently, only constraints.txt and requirements.txt are supported.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l only -d 'The only dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l output -d 'The name of the output file.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l with -d 'The optional dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l with-credentials -d 'Include credentials for extra indices.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l without -d 'The dependency groups to ignore.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l without-hashes -d 'Exclude hashes from the exported file.'
complete -c poetry -A -n '__fish_seen_subcommand_from export' -l without-urls -d 'Exclude source repository urls from the exported file.'

# help

# init
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l author -d 'Author name of the package.'
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l dependency -d 'Package to require, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.'
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l description -d 'Description of the package.'
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l dev-dependency -d 'Package to require for development, with an optional version constraint, e.g. requests:^2.10.0 or requests=2.11.1.'
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l license -d 'License of the package.'
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l name -d 'Name of the package.'
complete -c poetry -A -n '__fish_seen_subcommand_from init' -l python -d 'Compatible Python versions.'

# install
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l all-extras -d 'Install all extra dependencies.'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l compile -d 'Compile Python source files to bytecode. (This option has no effect if modern-installation is disabled because the old installer always compiles.)'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l extras -d 'Extra sets of dependencies to install.'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l no-dev -d 'Do not install the development dependencies. (Deprecated)'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l no-directory -d 'Do not install any directory path dependencies; useful to install dependencies without source code, e.g. for caching of Docker layers)'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l no-root -d 'Do not install the root package (the current project).'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l only -d 'The only dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l only-root -d 'Exclude all dependencies.'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l remove-untracked -d 'Removes packages not present in the lock file. (Deprecated)'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l sync -d 'Synchronize the environment with the locked packages and the specified groups.'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l with -d 'The optional dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from install' -l without -d 'The dependency groups to ignore.'

# list

# lock
complete -c poetry -A -n '__fish_seen_subcommand_from lock' -l check -d 'Check that the poetry.lock file corresponds to the current version of pyproject.toml.'
complete -c poetry -A -n '__fish_seen_subcommand_from lock' -l no-update -d 'Do not update locked versions, only refresh lock file.'

# new
complete -c poetry -A -n '__fish_seen_subcommand_from new' -l name -d 'Set the resulting package name.'
complete -c poetry -A -n '__fish_seen_subcommand_from new' -l readme -d 'Specify the readme file format. One of md (default) or rst'
complete -c poetry -A -n '__fish_seen_subcommand_from new' -l src -d 'Use the src layout for the project.'

# publish
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l build -d 'Build the package before publishing.'
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l cert -d 'Certificate authority to access the repository.'
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l client-cert -d 'Client certificate to access the repository.'
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l dry-run -d 'Perform all actions except upload the package.'
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l password -d 'The password to access the repository.'
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l repository -d 'The repository to publish the package to.'
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l skip-existing -d 'Ignore errors from files already existing in the repository.'
complete -c poetry -A -n '__fish_seen_subcommand_from publish' -l username -d 'The username to access the repository.'

# remove
complete -c poetry -A -n '__fish_seen_subcommand_from remove' -l dev -d 'Remove a package from the development dependencies. (Deprecated) Use --group=dev instead.'
complete -c poetry -A -n '__fish_seen_subcommand_from remove' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
complete -c poetry -A -n '__fish_seen_subcommand_from remove' -l group -d 'The group to remove the dependency from.'
complete -c poetry -A -n '__fish_seen_subcommand_from remove' -l lock -d 'Do not perform operations (only update the lockfile).'

# run

# search

# 'self add'
complete -c poetry -A -n '__fish_seen_subcommand_from "self add"' -l allow-prereleases -d 'Accept prereleases.'
complete -c poetry -A -n '__fish_seen_subcommand_from "self add"' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
complete -c poetry -A -n '__fish_seen_subcommand_from "self add"' -l editable -d 'Add vcs/path dependencies as editable.'
complete -c poetry -A -n '__fish_seen_subcommand_from "self add"' -l extras -d 'Extras to activate for the dependency.'
complete -c poetry -A -n '__fish_seen_subcommand_from "self add"' -l source -d 'Name of the source to use to install the package.'

# 'self install'
complete -c poetry -A -n '__fish_seen_subcommand_from "self install"' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
complete -c poetry -A -n '__fish_seen_subcommand_from "self install"' -l sync -d 'Synchronize the environment with the locked packages and the specified groups.'

# 'self lock'
complete -c poetry -A -n '__fish_seen_subcommand_from "self lock"' -l check -d 'Check that the poetry.lock file corresponds to the current version of pyproject.toml.'
complete -c poetry -A -n '__fish_seen_subcommand_from "self lock"' -l no-update -d 'Do not update locked versions, only refresh lock file.'

# 'self remove'
complete -c poetry -A -n '__fish_seen_subcommand_from "self remove"' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'

# 'self show'
complete -c poetry -A -n '__fish_seen_subcommand_from "self show"' -l addons -d 'List only add-on packages installed.'
complete -c poetry -A -n '__fish_seen_subcommand_from "self show"' -l latest -d 'Show the latest version.'
complete -c poetry -A -n '__fish_seen_subcommand_from "self show"' -l outdated -d 'Show the latest version but only for packages that are outdated.'
complete -c poetry -A -n '__fish_seen_subcommand_from "self show"' -l tree -d 'List the dependencies as a tree.'

# 'self show plugins'

# 'self update'
complete -c poetry -A -n '__fish_seen_subcommand_from "self update"' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
complete -c poetry -A -n '__fish_seen_subcommand_from "self update"' -l preview -d 'Allow the installation of pre-release versions.'

# shell

# show
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l all -d 'Show all packages (even those not compatible with current system).'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l latest -d 'Show the latest version.'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l no-dev -d 'Do not list the development dependencies. (Deprecated)'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l only -d 'The only dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l outdated -d 'Show the latest version but only for packages that are outdated.'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l top-level -d 'Show only top-level dependencies.'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l tree -d 'List the dependencies as a tree.'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l why -d 'When showing the full list, or a --tree for a single package, also display why it\'s included.'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l with -d 'The optional dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from show' -l without -d 'The dependency groups to ignore.'

# 'source add'
complete -c poetry -A -n '__fish_seen_subcommand_from "source add"' -l default -d 'Set this source as the default (disable PyPI). A default source will also be the fallback source if you add other sources. (Deprecated, use --priority)'
complete -c poetry -A -n '__fish_seen_subcommand_from "source add"' -l priority -d 'Set the priority of this source. One of: default, primary, secondary, supplemental, explicit. Defaults to primary.'
complete -c poetry -A -n '__fish_seen_subcommand_from "source add"' -l secondary -d 'Set this source as secondary. (Deprecated, use --priority)'

# 'source remove'

# 'source show'

# update
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l dry-run -d 'Output the operations but do not execute anything (implicitly enables --verbose).'
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l lock -d 'Do not perform operations (only update the lockfile).'
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l no-dev -d 'Do not update the development dependencies. (Deprecated)'
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l only -d 'The only dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l with -d 'The optional dependency groups to include.'
complete -c poetry -A -n '__fish_seen_subcommand_from update' -l without -d 'The dependency groups to ignore.'

# version
complete -c poetry -A -n '__fish_seen_subcommand_from version' -l dry-run -d 'Do not update pyproject.toml file'
complete -c poetry -A -n '__fish_seen_subcommand_from version' -l short -d 'Output the version number only'

@mrmeszaros
Copy link

mrmeszaros commented Jun 14, 2023

@Asseel-Naji Sadly this does not work under fish, version 3.6.1. Care to share your working setup?

Here is what I tried:

  1. Tried poetry env info --e[TAB] and it did not complete.

  2. Tried inverting the quotes (double to single and vice versa - as seen below), but it does not work either.

    complete -c poetry -A -n "__fish_seen_subcommand_from 'env info'" -l executable -d 'Only display the environment\'s python executable path.'
  3. Tried using without the any quotes (as seen below), and it did the autocomplete.
    HOWEVER, that way poetry env use --e[TAB] also completes to --executable which is wrong (the option does not exist).

    complete -c poetry -A -n '__fish_seen_subcommand_from env info' -l executable -d 'Only display the environment\'s python executable path.'

After some digging, it seems to me that the fish-shell/fish-shell#7107 issue is tackling a similar problem (nested subcommand and option parsing), might be worth looking into once it's resolved.

@Asseel-Naji
Copy link

  1. Tried poetry env info --e[TAB] and it did not complete.

I just tried the same, poetry env info can only be followed by :

--ansi                                                                                      (Force ANSI output.)
--directory          (The working directory for the Poetry command (defaults to the current working directory).)
--help         (Display help for the given command. When no command is given display help for the list command.)
--no-ansi                                                                                 (Disable ANSI output.)
--no-cache                                                                      (Disables Poetry source caches.)
--no-interaction                                                          (Do not ask any interactive question.)
--no-plugins                                                                                 (Disables plugins.)
--quiet                                                                             (Do not output any message.)
--verbose  (Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.)
--version                                                                    (Display this application version.)

That's said, if it's indeed doesn't work on intended command. Could you make sure the content of the file are pasted in ~/.config/fish/completions/poetry.fish and after that restart fish.

@mrmeszaros
Copy link

Did all that - same results.

Let me explain my issue: here is the help page for poetry env info

$ poetry env info --help

Description:
  Displays information about the current environment.

Usage:
  env info [options]

Options:
  -p, --path                 Only display the environment's path.
  -e, --executable           Only display the environment's python executable path.
  -h, --help                 Display help for the given command. When no command is given display help for the list command.
  -q, --quiet                Do not output any message.
  -V, --version              Display this application version.
      --ansi                 Force ANSI output.
      --no-ansi              Disable ANSI output.
  -n, --no-interaction       Do not ask any interactive question.
      --no-plugins           Disables plugins.
      --no-cache             Disables Poetry source caches.
  -C, --directory=DIRECTORY  The working directory for the Poetry command (defaults to the current working directory).
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.

As You can see the help page clearly notes the -e, --executable option.
The completions script - as You also see on Your system - fails to provide that option when asking for completions.

However I see that the subcommand specific options might not be in the scope of this issue, and might need a separate one.

@drin
Copy link

drin commented Jul 18, 2023

It takes time, to do things right. At the moment, I am the only person actively working on Cleo maintenance.

@Secrus I know it takes time, but just share the list of issues you want addressed before cutting a release of cleo and I suspect people will help. You don't even have to document them, just list them and see if we can do the rest. Or perhaps just let us know how you'd like us to cherry-pick the commit and cut a new release and we can move on.

It's one thing for there to be enhancements or bug fixes you want to get around to, but this issue requires manual intervention everytime there's an update and the amount of work required for someone to help seems trivial. I'm not sure why this has to drag on any longer than it has.

Edit: oh, actually maybe this milestone is what you want to have complete before the next release?
https://github.com/python-poetry/cleo/milestone/9

@drin
Copy link

drin commented Jul 18, 2023

However I see that the subcommand specific options might not be in the scope of this issue, and might need a separate one.

@mrmeszaros I agree that would be a separate issue, since this one was just focused on the errors/warnings produced by quoting errors. I'm not sure if a related issue already exists, though.

@Anselmoo
Copy link

Anselmoo commented Jan 6, 2024

@Asseel-Naji Sadly this does not work under fish, version 3.6.1. Care to share your working setup?

Here is what I tried:

  1. Tried poetry env info --e[TAB] and it did not complete.
  2. Tried inverting the quotes (double to single and vice versa - as seen below), but it does not work either.
    complete -c poetry -A -n "__fish_seen_subcommand_from 'env info'" -l executable -d 'Only display the environment\'s python executable path.'
  3. Tried using without the any quotes (as seen below), and it did the autocomplete.
    HOWEVER, that way poetry env use --e[TAB] also completes to --executable which is wrong (the option does not exist).
    complete -c poetry -A -n '__fish_seen_subcommand_from env info' -l executable -d 'Only display the environment\'s python executable path.'

After some digging, it seems to me that the fish-shell/fish-shell#7107 issue is tackling a similar problem (nested subcommand and option parsing), might be worth looking into once it's resolved.

Could it be that

image

without \' for 'List Poetry\'s caches.'

image

that the backslash is actually not working?

@Secrus Secrus transferred this issue from python-poetry/poetry Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.