Commit 7aca7b20 by Arun Babu Neelicattu

cli: add self show command

parent 26dc84d1
......@@ -87,6 +87,7 @@ COMMANDS = [
"self install",
"self remove",
"self update",
"self show",
# Source commands
"source add",
"source remove",
......
......@@ -85,7 +85,7 @@ class GroupCommand(EnvCommand):
for key in {"with", "without", "only"}:
groups[key] = {
group.strip()
for groups in self.option(key)
for groups in self.option(key, "")
for group in groups.split(",")
}
......
from __future__ import annotations
from cleo.helpers import option
from poetry.console.commands.self.self_command import SelfCommand
from poetry.console.commands.show import ShowCommand
class SelfShowCommand(SelfCommand, ShowCommand):
name = "self show"
options = [
option("addons", None, "List only add-on packages installed."),
*[o for o in ShowCommand.options if o.name in {"tree", "latest", "outdated"}],
]
description = "Show packages from Poetry's runtime environment."
help = f"""\
The <c1>self show</c1> command behaves similar to the <c1>show</c1> command, but
working within Poetry's runtime environment. This lists all packages installed within
the Poetry install environment.
To show only additional packages that have been added via <c1>self add</c1> and their
dependencies use <c1>self show --addons</c1>.
This is managed in the <comment>{SelfCommand.get_default_system_pyproject_file()}</> \
file.
"""
@property
def activated_groups(self) -> set[str]:
if self.option("addons", False):
return {SelfCommand.ADDITIONAL_PACKAGE_GROUP}
return super(ShowCommand, self).activated_groups
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment