# iep-led(1) completion                                    -*- shell-script -*-

_iep_led ()
{
    local cur
    cur=${COMP_WORDS[COMP_CWORD]}
    local prev
    prev=${COMP_WORDS[COMP_CWORD-1]}
    
    case "$prev" in
        iep-led)
            COMPREPLY=($(find "/run/shm/3d-p/gpio-led/" \
                -maxdepth 1 -xtype f -name "$cur*" -printf '%f\n'))
            return 0
            ;;
        *)
            COMPREPLY=($(find "/usr/share/iep-coreutils/led-patterns/" \
                -maxdepth 1 -xtype f -name "$cur*" -printf '%f\n'))
            return 0
            ;;
    esac
} &&
complete -F _iep_led iep-led

# ex: ts=4 sw=4 et filetype=sh
