1# Copy this file to /etc/bash_completion.d/xl.sh 2 3_xl() 4{ 5 local IFS=$'\n,' 6 7 local cur opts xl 8 COMPREPLY=() 9 cur="${COMP_WORDS[COMP_CWORD]}" 10 xl=xl 11 12 if [[ $COMP_CWORD == 1 ]] ; then 13 opts=`${xl} help 2>/dev/null | sed '1,4d' | awk '/^ [^ ]/ {print $1}' | sed 's/$/ ,/g'` && COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) 14 return 0 15 fi 16 17 return 0 18} 19 20complete -F _xl -o nospace -o default xl 21