comparison contrib/bash_completion @ 1642:b8d792057e5b

bash_completion: always use single quotes with compgen -W This avoids a bug in bash 2.05a
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 27 Jan 2006 12:11:14 +0100
parents 1ef060ae7966
children 747c8d03bd29
comparison
equal deleted inserted replaced
1641:1ef060ae7966 1642:b8d792057e5b
39 { 39 {
40 local all commands result 40 local all commands result
41 41
42 all=$(_hg_command_list) 42 all=$(_hg_command_list)
43 commands=${all%%$'\n'debug*} 43 commands=${all%%$'\n'debug*}
44 result=$(compgen -W "$commands" -- "$cur") 44 result=$(compgen -W '$commands' -- "$cur")
45 45
46 # hide debug commands from users, but complete them if 46 # hide debug commands from users, but complete them if
47 # there is no other possible command 47 # there is no other possible command
48 if [ "$result" = "" ]; then 48 if [ "$result" = "" ]; then
49 local debug 49 local debug
50 debug=debug${all#*$'\n'debug} 50 debug=debug${all#*$'\n'debug}
51 result=$(compgen -W "$debug" -- "$cur") 51 result=$(compgen -W '$debug' -- "$cur")
52 fi 52 fi
53 53
54 COMPREPLY=(${COMPREPLY[@]:-} $result) 54 COMPREPLY=(${COMPREPLY[@]:-} $result)
55 } 55 }
56 56
57 _hg_paths() 57 _hg_paths()
58 { 58 {
59 local paths="$(hg paths | sed -e 's/ = .*$//')" 59 local paths="$(hg paths | sed -e 's/ = .*$//')"
60 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$paths" -- "$cur" )) 60 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$paths' -- "$cur" ))
61 } 61 }
62 62
63 _hg_repos() 63 _hg_repos()
64 { 64 {
65 local i 65 local i
69 } 69 }
70 70
71 _hg_status() 71 _hg_status()
72 { 72 {
73 local files="$( hg status -n$1 . )" 73 local files="$( hg status -n$1 . )"
74 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W "$files" -- "$cur" )) 74 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$files' -- "$cur" ))
75 } 75 }
76 76
77 _hg_tags() 77 _hg_tags()
78 { 78 {
79 local tags="$(hg tags | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')" 79 local tags="$(hg tags | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
80 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$tags" -- "$cur") ) 80 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") )
81 } 81 }
82 82
83 # this is "kind of" ugly... 83 # this is "kind of" ugly...
84 _hg_count_non_option() 84 _hg_count_non_option()
85 { 85 {
121 done 121 done
122 122
123 if [[ "$cur" == -* ]]; then 123 if [[ "$cur" == -* ]]; then
124 opts=$(_hg_option_list $cmd) 124 opts=$(_hg_option_list $cmd)
125 125
126 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$opts" -- "$cur") ) 126 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur") )
127 return 127 return
128 fi 128 fi
129 129
130 # global options 130 # global options
131 case "$prev" in 131 case "$prev" in