mccli.scp_utils

class ScpOperand(remote=False, uri=False, user=None, host=None, path=None, port=None, original_str=None)

Bases: object

property remote

whether it is a remote path

property uri

whether the path is specified in URI form cf. RFCRFC3986

property user

remote user, if specified, or None if it is a local path

property host

remote hostname or None if it is a local path

property path

path, local or on remote host

property port

port for SSH service

property original_str

original string that was parsed into this class

unsplit(user)
class ScpUseCase(value)

Bases: Enum

Possible cases when running scp:

  • case 1: no motley_cue handling needed
    • all local paths, or

    • all remotes have user specified

  • case 2: a single motley_cue remote host
    • can also appear multiple times

    • the user can be passed as an ssh option with ‘-o’

    • no other remotes with specified users are present

  • case 3: multiple remotes
    • the sources/target have to be modified to pass the username

NO_MOTLEY_CUE = (1,)
SINGLE_REMOTE = (2,)
MULTIPLE_REMOTES = 3
class ScpCommand(opts, sources, target)

Bases: object

property use_case
property opts
property sources
property target
property mc_host
property num_prompts
no_mc()
single_mc()
multiple_mc()
parse_scp_args(scp_args)

Extract source and target from the arguments of an scp command, represented as a list, and return an ScpCommand.