Sha256: 9d670a55b3fce0161dd422bff9cffec32d35b2e7d2e9eef237ec873a8883890c

Contents?: true

Size: 1.72 KB

Versions: 1

Compression:

Stored size: 1.72 KB

Contents

#compdef ec2ssh

# main completion function
_ec2ssh-init() {
    local ret
    _call_function ret __ec2ssh_noarg_cmd
    return $ret
}

_ec2ssh-remove() {
    local ret
    _call_function ret __ec2ssh_noarg_cmd
    return $ret
}

_ec2ssh-update() {
    local curcontext context state line
    declare -A opt_args

    integer ret=1
    _arguments -C -S \
               '--aws-key:aws key name' \
               '--dotfile:ec2ssh dotfile:_files' \
               '--verbose' && return
    return $ret
}

_ec2ssh-version() {
    local ret
    _call_function ret __ec2ssh_noarg_cmd
    return $ret
}

__ec2ssh_noarg_cmd() {
    local curcontext context state line
    declare -A opt_args

    integer ret=1
    _arguments -C -S \
        '--dotfile:ec2ssh dotfile:_files' \
        '--verbose' && return
    return $ret
}

_ec2ssh() {
    local curcontext context state line
    declare -A opt_args

    integer ret=1

    _arguments -C -S \
        '--dotfile:ec2ssh dotfile:_files' \
        '--verbose' \
        '(-): :->commands' \
        '(-)*:: :->option-or-argument' && return

    case $state in
        (commands)
            _ec2ssh_commands && ret=0
            ;;
        (option-or-argument)
            if (( $+functions[_ec2ssh-$words[1]] )); then
                _call_function ret _ec2ssh-$words[1]
            else
                _message 'no completion'
            fi
            ;;
    esac

    return ret
}

_ec2ssh_commands() {
    _values 'command' \
        'help[Describe available commands or one specific command]' \
        'init[Add ec2ssh mark to ssh_config]' \
        'remove[Remove ec2ssh mark from ssh_config]' \
        'update[Update ec2 hosts list in ssh_config]' \
        'version[Show version]'
}

compdef _ec2ssh ec2ssh

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ec2ssh-4.0.0 zsh/_ec2ssh