comparison contrib/bash_completion @ 1149:f82b084bd904

bash_completion: update for new help output format
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Mon, 29 Aug 2005 20:37:07 +0200
parents 89f54e72581d
children 4ee09418c8e5
comparison
equal deleted inserted replaced
1148:fad2d091c74f 1149:f82b084bd904
71 break 71 break
72 fi 72 fi
73 done 73 done
74 74
75 if [[ "$cur" == -* ]]; then 75 if [[ "$cur" == -* ]]; then
76 opts="$(hg -v help | sed -e '1,/^global options/d; /^ -/!d')" 76 # this assumes that there are no commands with spaces in the name
77 77 opts=$(hg -v help $cmd | sed -e '/^ *-/!d; s/ [^- ].*//')
78 if [ -n "$cmd" ]; then
79 opts="$opts $(hg help "$cmd" | sed -e '/^ -/!d; s/ [^-][^ ]*//')"
80 fi
81 78
82 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$opts" -- "$cur") ) 79 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W "$opts" -- "$cur") )
83 return 80 return
84 fi 81 fi
85 82