Sha256: 58bf9bf274b0cc10fb8ba1c61d4efca779c23c2a08b7a6e243195b23f2bd9a70

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# bash completion support for ec2ssh

_ec2ssh() {
    local cmd cur prev subcmd
    cmd=$1
    cur=$2
    prev=$3

    subcmds="help init remove update version"
    common_opts="--dotfile --verbose"

    # contextual completion
    case $prev in
        ec2ssh)
            case "$cur" in
                -*)
                    COMPREPLY=( $(compgen -W "$common_opts" $cur) )
                    ;;
                *)
                    COMPREPLY=( $(compgen -W "$subcmds" $cur) )
            esac
            return 0
            ;;
        --aws-key)
            COMPREPLY=()
            return 0;
            ;;
        --dotfile)
            COMPREPLY=( $(compgen -o default -- "$cur"))
            return 0;
            ;;
    esac

    # complete options
    subcmd=${COMP_WORDS[1]}

    case $subcmd in
        update)
            COMPREPLY=( $(compgen -W "--aws-key $common_opts" -- "$cur") )
            ;;
        help)
            COMPREPLY=( $(compgen -W "$subcmds" $cur) )
            ;;
        *)
            COMPREPLY=( $(compgen -W "$common_opts" -- "$cur") )
            ;;
    esac

    return 0

}

complete -F _ec2ssh ec2ssh

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ec2ssh-4.0.0 bash/ec2ssh.bash