colinmarc-hdfs/cmd/hdfs/bash_completion

21 строка
412 B
Bash

#!/bin/bash
_hdfs_complete()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
words=$(IFS=$' '; echo "${COMP_WORDS[*]}")
opts=$(${COMP_WORDS[0]} complete "$words")
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
if [[ $COMPREPLY != "" && $COMPREPLY != */ ]]
then
COMPREPLY="$COMPREPLY "
fi
return 0
}
complete -o nospace -F _hdfs_complete hdfs