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

poetry -h shows help for poetry list #249

Open
2 tasks done
Secrus opened this issue May 21, 2022 · 3 comments
Open
2 tasks done

poetry -h shows help for poetry list #249

Secrus opened this issue May 21, 2022 · 3 comments
Milestone

Comments

@Secrus
Copy link
Member

Secrus commented May 21, 2022

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • OS version and name: Ubuntu 18.04

  • Poetry version: 1.2.0b2 (absolute latest from master branch)

Issue

As in the title, in version 1.2, running poetry -h/poetry --help, returns help for the list command. This is a regression compared to version 1.1.x.

Poetry 1.1.13 output
$ poetry -h
Poetry version 1.1.13

USAGE
poetry [-h] [-q] [-v [<...>]] [-V] [--ansi] [--no-ansi] [-n] [] ... []

ARGUMENTS
<command> The command to execute
<arg> The arguments of the command

GLOBAL OPTIONS
-h (--help) Display this help message
-q (--quiet) Do not output any message
-v (--verbose) Increase the verbosity of messages: "-v" for normal output, "-vv" for more verbose output and "-vvv" for debug
-V (--version) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n (--no-interaction) Do not ask any interactive question

AVAILABLE COMMANDS
about Shows information about Poetry.
add Adds a new dependency to pyproject.toml.
build Builds a package, as a tarball and a wheel by default.
cache Interact with Poetry's cache
check Checks the validity of the pyproject.toml file.
config Manages configuration settings.
debug Debug various elements of Poetry.
env Interact with Poetry's project environments.
export Exports the lock file to alternative formats.
help Display the manual of a command
init Creates a basic pyproject.toml file in the current directory.
install Installs the project dependencies.
lock Locks the project dependencies.
new Creates a new Python project at .
publish Publishes a package to a remote repository.
remove Removes a package from the project dependencies.
run Runs a command in the appropriate environment.
search Searches for packages on remote repositories.
self Interact with Poetry directly.
shell Spawns a shell within the virtual environment.
show Shows information about packages.
update Update the dependencies as according to the pyproject.toml file.
version Shows the version of the project or bumps it when a valid bump rule is provided.


Poetry 1.2.0b2 output
$ poetry -h

Description:
Lists commands.

Usage:
list [options] [--] []

Arguments:
namespace The namespace name

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.

Help:
The list command lists all commands:

poetry list

You can also display the commands for a specific namespace:

poetry list test

@dimbleby
Copy link
Contributor

dimbleby commented May 21, 2022

Changed at python-poetry/poetry#3618

cleo is a bit of a mystery to me, I don't know what's going on...

Edit: looks like this is simply default cleo behaviour. The example application in the cleo README behaves just the same way (after you fix the imports so that it works).

So I guess this is either working as designed, or wants taking to the cleo repository.

@John15321
Copy link

Looking into that

@John15321
Copy link

@Secrus @dimbleby
Looks like its caused by this method not being implemented:

raise NotImplementedError()

It is called by the _get_command_name method when the program checks if a command that is called has a registered (?) name:

name = self._get_command_name(io)

Which then calls _get_command_name:

def _get_command_name(self, io: IO) -> str:

It tried to return the first parsed argument by calling io.input.first_argument but it's not implemented thus returning None, therefore the program thinks the user is not asking for help and prints the default command which is list as defined here:

self._default_command = "list"

So in my humble opinion, I would either implement the above-mentioned method or change the default command to be help which Im actually surprised is not the default as it kinda sounds reasonable

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

No branches or pull requests

3 participants