Fix bash completion for feeds2*

This commit is contained in:
Kovid Goyal 2008-03-24 09:59:01 +00:00
parent 3172795aa2
commit 59de496c56

View File

@ -77,13 +77,13 @@ def options(option_parser):
return opts return opts
def opts_and_words(name, op, words): def opts_and_words(name, op, words):
opts = ' '.join(options(op)) opts = '|'.join(options(op))
words = [repr(w) for w in words] words = '|'.join([w.replace("'", "\\'") for w in words])
words = ' '.join(words)
return '_'+name+'()'+\ return '_'+name+'()'+\
''' '''
{ {
local cur prev opts local cur prev opts
local IFS=$'|\\t'
COMPREPLY=() COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
opts="%s" opts="%s"
@ -92,10 +92,12 @@ def opts_and_words(name, op, words):
case "${cur}" in case "${cur}" in
-* ) -* )
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
COMPREPLY=( $( echo ${COMPREPLY[@]} | sed 's/ /\\\\ /g' | tr '\\n' '\\t' ) )
return 0 return 0
;; ;;
* ) * )
COMPREPLY=( $(compgen -W "${words}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${words}" -- ${cur}) )
COMPREPLY=( $( echo ${COMPREPLY[@]} | sed 's/ /\\\\ /g' | tr '\\n' '\\t' ) )
return 0 return 0
;; ;;
esac esac