equal
deleted
inserted
replaced
26 # { |
26 # { |
27 # if [ -r ~/.patchbomb-$1 ]; then |
27 # if [ -r ~/.patchbomb-$1 ]; then |
28 # cat ~/.patchbomb-$1 |
28 # cat ~/.patchbomb-$1 |
29 # fi |
29 # fi |
30 # } |
30 # } |
31 # |
31 # |
32 # |
32 # |
33 # Writing completion functions for additional commands: |
33 # Writing completion functions for additional commands: |
34 # |
34 # |
35 # If it exists, the function _hg_cmd_foo will be called without |
35 # If it exists, the function _hg_cmd_foo will be called without |
36 # arguments to generate the completion candidates for the hg command |
36 # arguments to generate the completion candidates for the hg command |
48 # - $prev - the argument before $cur |
48 # - $prev - the argument before $cur |
49 # - $global_args - "|"-separated list of global options that accept |
49 # - $global_args - "|"-separated list of global options that accept |
50 # an argument (e.g. '--cwd|-R|--repository') |
50 # an argument (e.g. '--cwd|-R|--repository') |
51 # - $canonical - 1 if we canonicalized $cmd before calling the function |
51 # - $canonical - 1 if we canonicalized $cmd before calling the function |
52 # 0 otherwise |
52 # 0 otherwise |
53 # |
53 # |
54 |
54 |
55 shopt -s extglob |
55 shopt -s extglob |
56 |
56 |
57 _hg_commands() |
57 _hg_commands() |
58 { |
58 { |
423 fi |
423 fi |
424 fi |
424 fi |
425 done |
425 done |
426 |
426 |
427 if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then |
427 if [ -z "$subcmd" ] || [ $COMP_CWORD -eq $i ] || [ "$subcmd" = help ]; then |
428 COMPREPLY=(${COMPREPLY[@]:-} |
428 COMPREPLY=(${COMPREPLY[@]:-} |
429 $(compgen -W 'bad good help init next reset' -- "$cur")) |
429 $(compgen -W 'bad good help init next reset' -- "$cur")) |
430 return |
430 return |
431 fi |
431 fi |
432 |
432 |
433 case "$subcmd" in |
433 case "$subcmd" in |
443 # patchbomb |
443 # patchbomb |
444 _hg_cmd_email() |
444 _hg_cmd_email() |
445 { |
445 { |
446 case "$prev" in |
446 case "$prev" in |
447 -c|--cc|-t|--to|-f|--from|--bcc) |
447 -c|--cc|-t|--to|-f|--from|--bcc) |
448 # we need an e-mail address. let the user provide a function |
448 # we need an e-mail address. let the user provide a function |
449 # to get them |
449 # to get them |
450 if [ "$(type -t _hg_emails)" = function ]; then |
450 if [ "$(type -t _hg_emails)" = function ]; then |
451 local arg=to |
451 local arg=to |
452 if [[ "$prev" == @(-f|--from) ]]; then |
452 if [[ "$prev" == @(-f|--from) ]]; then |
453 arg=from |
453 arg=from |