Mercurial > hg
comparison contrib/bash_completion @ 3486:f699d4eb25d9
bash_completion: qguard
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sun, 22 Oct 2006 01:02:13 -0300 |
parents | 26285469db9b |
children | d86ab4ba5ae6 |
comparison
equal
deleted
inserted
replaced
3485:26285469db9b | 3486: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 |