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

list: Add --clean for portable output #392

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/pipx/commands/list_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
from pipx.venv import VenvContainer


def list_packages(venv_container: VenvContainer):
def list_packages(venv_container: VenvContainer, clean: bool):
dirs = list(sorted(venv_container.iter_venv_dirs()))
if not dirs:
print(f"nothing has been installed with pipx {sleep}")
return

print(f"venvs are in {bold(str(venv_container))}")
print(f"apps are exposed on your $PATH at {bold(str(constants.LOCAL_BIN_DIR))}")
if not clean:
print(f"venvs are in {bold(str(venv_container))}")
print(f"apps are exposed on your $PATH at {bold(str(constants.LOCAL_BIN_DIR))}")

venv_container.verify_shared_libs()

Expand Down
3 changes: 2 additions & 1 deletion src/pipx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def run_pipx_command(args: argparse.Namespace): # noqa: C901
venv_dir, package, pip_args, verbose, upgrading_all=False, force=args.force
)
elif args.command == "list":
return commands.list_packages(venv_container)
return commands.list_packages(venv_container, args.clean)
elif args.command == "uninstall":
return commands.uninstall(venv_dir, package, constants.LOCAL_BIN_DIR, verbose)
elif args.command == "uninstall-all":
Expand Down Expand Up @@ -388,6 +388,7 @@ def _add_list(subparsers):
description="List packages and apps installed with pipx",
)
p.add_argument("--verbose", action="store_true")
p.add_argument("--clean", action="store_true")


def _add_run(subparsers):
Expand Down