diff --git a/CHANGELOG.md b/CHANGELOG.md index ef96825a..0f8b3727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- The help of `cloudsmith credential-helper`, `credential-helper install` and `credential-helper uninstall` now lists every helper, including `maven`, `gradle` and `sbt`, and has examples for Maven. The help also explains that Maven, Gradle and sbt have no runtime command of their own. (ENG-15733) + ## [1.31.0] - 2026-11-11 ### Added diff --git a/cloudsmith_cli/cli/commands/credential_helper/__init__.py b/cloudsmith_cli/cli/commands/credential_helper/__init__.py index bcf76528..f5da38bd 100644 --- a/cloudsmith_cli/cli/commands/credential_helper/__init__.py +++ b/cloudsmith_cli/cli/commands/credential_helper/__init__.py @@ -22,9 +22,17 @@ def credential_helper(): """ Credential helpers for package managers. - These commands provide credentials for package managers like Docker. - Use ``install`` to set up the on-PATH launcher and configure the package - manager automatically, or run the runtime command directly for debugging. + These commands provide credentials for package managers. Use ``install`` + to set up a helper and configure the package manager automatically, and + ``list`` to see every helper and whether it is installed. + + \b + Helpers: cargo, docker, gradle, maven, pnpm, sbt, terraform. + + Docker, pnpm, cargo and Terraform call the runtime command of the same + name, which you can also run directly for debugging. Maven, Gradle and + sbt load a Cloudsmith extension or plugin that gets credentials from + ``generic``, so they have no runtime command of their own. Examples: @@ -37,6 +45,12 @@ def credential_helper(): \b # Install cargo credential helper $ cloudsmith credential-helper install cargo + \b + # Install the Maven extension (also: gradle, sbt) + $ cloudsmith credential-helper install maven + \b + # List the helpers and their installation status + $ cloudsmith credential-helper list \b # Test Docker credential helper directly $ echo "docker.cloudsmith.io" | cloudsmith credential-helper docker diff --git a/cloudsmith_cli/cli/commands/credential_helper/manage.py b/cloudsmith_cli/cli/commands/credential_helper/manage.py index 87980080..46b3cccc 100644 --- a/cloudsmith_cli/cli/commands/credential_helper/manage.py +++ b/cloudsmith_cli/cli/commands/credential_helper/manage.py @@ -381,7 +381,8 @@ def install_cmd( ) -> None: """Install a credential helper launcher and configure the package manager. - HELPER is the name of the credential helper to install (e.g. ``docker``, ``pnpm``). + HELPER is the name of the credential helper to install: one of ``cargo``, + ``docker``, ``gradle``, ``maven``, ``pnpm``, ``sbt`` or ``terraform``. Important for pnpm: The tokenHelper directive is only honored in the user-level ~/.npmrc file, not in a project-level .npmrc. This is a pnpm @@ -410,6 +411,10 @@ def install_cmd( # Terraform: bake the repository into the terraformrc args so # `terraform init` needs no CLOUDSMITH_REPO env var $ cloudsmith credential-helper install terraform -w acme --repo my-repo + + \b + # Maven: set up only the Maven project in the current directory + $ cloudsmith credential-helper install maven --local """ installer = _get_installer(helper) helper_options = _helper_options(ctx, helper) @@ -536,7 +541,8 @@ def uninstall_cmd( ) -> None: """Uninstall a credential helper launcher and remove its config entries. - HELPER is the name of the credential helper to uninstall (e.g. ``docker``). + HELPER is the name of the credential helper to uninstall: one of ``cargo``, + ``docker``, ``gradle``, ``maven``, ``pnpm``, ``sbt`` or ``terraform``. Examples: @@ -547,6 +553,10 @@ def uninstall_cmd( \b # Preview without making changes $ cloudsmith credential-helper uninstall docker --dry-run + + \b + # Uninstall the Maven extension + $ cloudsmith credential-helper uninstall maven """ installer = _get_installer(helper) try: diff --git a/cloudsmith_cli/cli/tests/commands/test_credential_helper_install.py b/cloudsmith_cli/cli/tests/commands/test_credential_helper_install.py index 758b53f5..51dc9709 100644 --- a/cloudsmith_cli/cli/tests/commands/test_credential_helper_install.py +++ b/cloudsmith_cli/cli/tests/commands/test_credential_helper_install.py @@ -1120,6 +1120,20 @@ def test_manage_cli_unknown_helper_exits_nonzero(runner): assert result.exit_code != 0 +@pytest.mark.parametrize("args", [[], ["install"], ["uninstall"]]) +def test_help_names_every_helper(runner, args): + """The help of the group, install and uninstall names every registered helper.""" + from ....cli.commands.credential_helper.manage import _INSTALLERS + + result = runner.invoke( + credential_helper, [*args, "--help"], terminal_width=200, catch_exceptions=False + ) + + assert result.exit_code == 0 + missing = [name for name in _INSTALLERS if name not in result.output] + assert not missing, f"--help does not mention: {missing}" + + # --------------------------------------------------------------------------- # 13. manage CLI dry-run # ---------------------------------------------------------------------------