Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- `--api-headers "Authorization=username:password"` accepts a password that contains a colon. Before, all commands stopped with a `ValueError`.
- `--api-headers "Authorization=username"` without a password shows a usage error for `--api-headers`. Before, the CLI showed a traceback.
- `--api-headers` with a blocked header, such as `user-agent=x`, or with a value that has no `=`, shows a usage error. Before, the CLI showed a traceback.
- `cloudsmith list dependencies --help` now shows the help for the dependencies list. Before, it showed the help for the entitlements list.
- `cloudsmith credential-helper list` now shows the pnpm hosts in `.npmrc` when the pnpm launcher is missing. Previously, the command showed no hosts, and pnpm still tried to run the missing launcher for those hosts.
- `list` also shows the pnpm hosts that you installed with `--bin-dir`. `cloudsmith credential-helper uninstall pnpm` now removes these `.npmrc` entries, as the Docker and Cargo uninstall commands do.
- `cloudsmith credential-helper list` now shows a helper as not configured when its config file is not valid, and it still lists the other helpers. This applies to a Docker `config.json` with a `credHelpers` value that is not an object, and to a Docker or Terraform config file that is not UTF-8. It also applies to a pnpm `.npmrc` that the CLI cannot read or decode. Previously, the command stopped with an error such as `AttributeError`.
Expand Down
16 changes: 10 additions & 6 deletions cloudsmith_cli/cli/commands/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from ...core.api.packages import get_package_dependencies
from .. import decorators, utils, validators
from ..config import Options
from ..exceptions import handle_api_exceptions
from ..utils import maybe_spinner
from .main import main
Expand All @@ -32,14 +33,17 @@ def wrapper(ctx, *args, **kwargs):
return wrapper


def list_dependencies(ctx, opts, owner_repo_package):
def list_dependencies(
ctx: click.Context, opts: Options, owner_repo_package: tuple[str, str, str]
) -> None:
"""
List direct (non-transitive) dependencies for a package.
List the direct dependencies of a package.

NOTE: These are not guaranteed to be complete, and only represent the *direct* /
*non-transitive* dependencies of a package. If packages consistently show
no dependencies then it is possible that dependency extraction isn't support
for the package format yet.
The list does not include transitive dependencies. For each dependency, the
list shows the type, the name, the version operator and the version.

The list can be incomplete. Cloudsmith does not extract dependencies for
all package formats. For those formats, the list is empty.

- OWNER/REPO/PACKAGE: Specify the OWNER namespace (i.e. user or org), the
REPO name where the package is stored, and the PACKAGE name (identifier/slug) of the
Expand Down
5 changes: 3 additions & 2 deletions cloudsmith_cli/cli/commands/list_.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import functools
from operator import itemgetter
from typing import Any

import click

Expand Down Expand Up @@ -32,9 +33,9 @@ def list_(ctx, opts): # pylint: disable=unused-argument

@list_.command(name="dependencies", aliases=["deps"])
@dependencies.list_dependencies_options
@functools.wraps(entitlements.list_entitlements)
@functools.wraps(dependencies.list_dependencies)
@click.pass_context
def dependencies_(*args, **kwargs): # pylint: disable=missing-docstring
def dependencies_(*args: Any, **kwargs: Any) -> None: # pylint: disable=missing-docstring
return dependencies.list_dependencies(*args, **kwargs)


Expand Down
10 changes: 10 additions & 0 deletions cloudsmith_cli/cli/tests/commands/test_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Tests for the `cloudsmith list` subcommands."""

from ....cli.commands.main import main


def test_list_deps_help_shows_dependencies_summary(runner):
result = runner.invoke(main, ["list", "deps", "--help"])

assert result.exit_code == 0
assert "dependencies" in result.stdout.split("\n\n")[1]
Loading