contrib/bash_completion
changeset 3481 f699d4eb25d9
parent 3480 26285469db9b
child 3992 d86ab4ba5ae6
equal deleted inserted replaced
3480:26285469db9b 3481:f699d4eb25d9
   368 {
   368 {
   369     local guards=$(_hg_ext_mq_guards)
   369     local guards=$(_hg_ext_mq_guards)
   370     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$guards' -- "$cur"))
   370     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$guards' -- "$cur"))
   371 }
   371 }
   372 
   372 
       
   373 _hg_cmd_qguard()
       
   374 {
       
   375     local prefix=''
       
   376 
       
   377     if [[ "$cur" == +* ]]; then
       
   378 	prefix=+
       
   379     elif [[ "$cur" == -* ]]; then
       
   380 	prefix=-
       
   381     fi
       
   382     local ncur=${cur#[-+]}
       
   383 
       
   384     if ! [ "$prefix" ]; then
       
   385 	_hg_ext_mq_patchlist qseries
       
   386 	return
       
   387     fi
       
   388 
       
   389     local guards=$(_hg_ext_mq_guards)
       
   390     COMPREPLY=(${COMPREPLY[@]:-} $(compgen -P $prefix -W '$guards' -- "$ncur"))
       
   391 }
       
   392 
       
   393 _hg_opt_qguard()
       
   394 {
       
   395     local i
       
   396     for ((i=cmd_index+1; i<=COMP_CWORD; i++)); do
       
   397 	if [[ ${COMP_WORDS[i]} != -* ]]; then
       
   398 	    if [[ ${COMP_WORDS[i-1]} != @($global_args) ]]; then
       
   399 		_hg_cmd_qguard
       
   400 		return 0
       
   401 	    fi
       
   402 	elif [ "${COMP_WORDS[i]}" = -- ]; then
       
   403 	    _hg_cmd_qguard
       
   404 	    return 0
       
   405 	fi
       
   406     done
       
   407     return 1
       
   408 }
       
   409 
   373 
   410 
   374 # hbisect
   411 # hbisect
   375 _hg_cmd_bisect()
   412 _hg_cmd_bisect()
   376 {
   413 {
   377     local i subcmd
   414     local i subcmd