HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/repo_cli/commands/move.py
"""
Move an artifact within Anaconda Repository.

example::

    conda repo move <CHANNEL_NAME>::<PACKAGE_NAME>/<PACKAGE_VERSION>/<FILE_NAME> -d <DESTINATION_CHANNEL>

"""

from ..utils.artifacts import PackageSpec
from .bulk_action import BulkActionCommand


class SubCommand(BulkActionCommand):
    name = "move"

    def add_parser(self, subparsers):
        parser = subparsers.add_parser(
            "move",
            help="Move packages from one channel to another.",
            description=__doc__,
        )

        parser.add_argument(
            "specs",
            help=(
                "Package - written as "
                "<channel>/<subchannel>[::<package>[/<version>[/<filename>]]]"
                "If filename is not given, move all files in the version"
            ),
            type=PackageSpec.from_string,
            nargs="+",
        )
        parser.add_argument(
            "-d", "--destination", help="Channel to put all packages into", default=None
        )
        parser.add_argument(
            "--family",
            default="conda",
            help="artifact family (i.e.: conda, python, cran, anaconda_project, "
            "anaconda_env, notebook, gra)",
        )

        parser.set_defaults(main=self.main)