1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
#!/bin/bash
_hdfs_complete()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
words=$(IFS=$' '; echo "${COMP_WORDS[@]:0:COMP_CWORD+1}")
opts=$(${COMP_WORDS[0]} complete "$words")
if [[ $opts == "_FILE_" ]]
then
COMPREPLY=( $(compgen -o default -- ${cur}) )
else
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
fi
if [[ $COMPREPLY != "" && $COMPREPLY != */ && $COMP_POINT == ${#COMP_LINE} ]]
then
COMPREPLY="$COMPREPLY "
fi
return 0
}
complete -o nospace -F _hdfs_complete hdfs
|