Sha256: eb79adf93762d3dc14792e792a32120140992e8fcc0565d86373556b96797dc3

Contents?: true

Size: 859 Bytes

Versions: 4

Compression:

Stored size: 859 Bytes

Contents

#!/usr/bin/env bash
#
# Sym command line completion
#
# © 2015-2016, Konstantin Gredeskoul,  https://github.com/kigster/sym
# MIT LICENSE
#

_sym() {
    local SYM_OPTS SYM_POINTS cur prev

    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    COMPREPLY=()

    #[[ $COMP_CWORD == 1 ]] && SYM_COMP_OPTIONS="${SYM_COMP_OPTIONS} ${SYM_COMMANDS}"
    if [[ $prev =~ "-f" || $prev =~ "-o" || $prev =~ "-K" || $prev == "--keyfile" ]] ; then 
      SYM_COMP_OPTIONS="$(find . -type f -depth 1 | sed 's#./##g')"
    elif  [[ "${cur}" == '--' || "${cur}" == --* ]] ; then 
      SYM_COMP_OPTIONS=$(sym --dictionary | sed -E 's/ /\n/g')
    else 
      SYM_COMP_OPTIONS=$(sym -h | egrep '  \-' | grep -v '^  --' | cut -d ',' -f 1)
    fi

    COMPREPLY=( $(compgen -W "${SYM_COMP_OPTIONS}" -- ${cur}) )
    return 0
}

complete -F _sym sym

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sym-2.1.2 bin/sym.completion
sym-2.1.1 bin/sym.completion
sym-2.1.0 bin/sym.completion
sym-2.0.3 bin/sym.completion