cleo icon indicating copy to clipboard operation
cleo copied to clipboard

Quotes required to use the built-in help command with a nested subcommand

Open paul-papacz opened this issue 3 years ago • 4 comments

  • [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 (-vvv option).
  • OS version and name: Ubuntu 22.04
  • Poetry version: 1.2.0
  • Link of a Gist with the contents of your pyproject.toml file: NOT RELEVANT

Issue

After installing poetry via curl -sSL https://install.python-poetry.org | python3 - when running

$ poetry help env

the following error occurs:

The command "env" does not exist.

Did you mean one of these?
    env use
    env info
    env list
    env remove

When running

$ poetry help env use

the exact same error occurs.

When running

$ poetry help "env use"

the help message is shown correctly:

Description:
  Activates or creates a new virtualenv for the current project.

Usage:
  env use [options] [--] <python>

Arguments:
  python                The python executable to use.

Options:
  -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.
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug.

paul-papacz avatar Sep 15 '22 10:09 paul-papacz

I think you missed this step from the installation script

To get started you need Poetry's bin directory (/root/.local/bin) in your PATH environment variable. Add export PATH="/root/.local/bin:$PATH" to your shell configuration file. Alternatively, you can call Poetry explicitly with /root/.local/bin/poetry.

ulisesojeda avatar Sep 15 '22 16:09 ulisesojeda

@ulisesojeda Thanks for trying to help, but in this case Poetry is invoked correctly and the usage of poetry help is surprising.

I'm migrating this to a Cleo issue as ultimately this related to Cleo nested subcommands and command parsing.

neersighted avatar Sep 15 '22 19:09 neersighted

Cleo needs to parse subcommands during <app> help the same way they are parsed during <app> <category> <command>, as well as possibly offer category-level help (though that is tangential and the existing hints are decent).

neersighted avatar Sep 15 '22 19:09 neersighted