Sha256: 41f9b5255bfa012b7aeba77df935970eaa1dad59c45cb1e52d77b2472c2de9f7

Contents?: true

Size: 1.63 KB

Versions: 2

Compression:

Stored size: 1.63 KB

Contents

#compdef ec2ssh

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

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

_ec2ssh-update() {
    local ret
    _call_function ret __ec2ssh_common_cmd
    return $ret
}

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

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

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

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

    integer ret=1

    _arguments -C -S \
        '--path:ssh_config file:_files' \
        '--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

2 entries across 2 versions & 1 rubygems

Version Path
ec2ssh-5.1.0 zsh/_ec2ssh
ec2ssh-5.0.0 zsh/_ec2ssh