From bda37d783bdce36921f37ca60719c8e022a13868 Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Mon, 27 Jul 2020 09:30:55 +0100 Subject: [PATCH] copy: add slug_perm to output When using the copy command to copy packages between repositories, the unique ID (slug_perm) of the package wasn't being printed to stdout. As with other commands (such as 'push') which did, the output of this could then be parsed to further operate on the specific package. Therefore, make the output from 'copy' behave in the same way. --- cloudsmith_cli/cli/commands/copy.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/cloudsmith_cli/cli/commands/copy.py b/cloudsmith_cli/cli/commands/copy.py index 9a072eb8..eba69868 100644 --- a/cloudsmith_cli/cli/commands/copy.py +++ b/cloudsmith_cli/cli/commands/copy.py @@ -58,27 +58,28 @@ def copy( """ owner, source, slug = owner_repo_package - click.echo( - "Copying %(slug)s package from %(source)s to %(dest)s ... " - % { - "slug": click.style(slug, bold=True), - "source": click.style(source, bold=True), - "dest": click.style(destination, bold=True), - }, - nl=False, - ) - context_msg = "Failed to copy package!" with handle_api_exceptions( ctx, opts=opts, context_msg=context_msg, reraise_on_error=skip_errors ): with maybe_spinner(opts): - _, new_slug = copy_package( + slug_perm, new_slug = copy_package( owner=owner, repo=source, identifier=slug, destination=destination ) click.secho("OK", fg="green") + click.echo( + "Copying %(slug)s package from %(source)s to %(dest)s (%(slug_perm)s)... " + % { + "slug": click.style(slug, bold=True), + "source": click.style(source, bold=True), + "dest": click.style(destination, bold=True), + "slug_perm": click.style(slug_perm, bold=True), + }, + nl=False, + ) + if no_wait_for_sync: return