contrib/bash_completion
changeset 1149 f82b084bd904
parent 1115 89f54e72581d
child 1150 4ee09418c8e5
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