contrib/zsh_completion
changeset 3587 c8494fcc9d39
parent 3546 6106236bc4eb
child 3597 0d253ec988a6
equal deleted inserted replaced
3586:66a17364c30e 3587:c8494fcc9d39
   138 }
   138 }
   139 
   139 
   140 _hg_unknown() {
   140 _hg_unknown() {
   141   typeset -a status_files
   141   typeset -a status_files
   142   _hg_status u
   142   _hg_status u
   143   (( $#status_files )) && _describe -t files 'unknown files' status_files
   143   _wanted files expl 'unknown files' _multi_parts / status_files
   144 }
   144 }
   145 
   145 
   146 _hg_missing() {
   146 _hg_missing() {
   147   typeset -a status_files
   147   typeset -a status_files
   148   _hg_status d
   148   _hg_status d
   149   (( $#status_files )) && _describe -t files 'missing files' status_files
   149   _wanted files expl 'missing files' _multi_parts / status_files
       
   150 }
       
   151 
       
   152 _hg_modified() {
       
   153   typeset -a status_files
       
   154   _hg_status m
       
   155   _wanted files expl 'modified files' _multi_parts / status_files
   150 }
   156 }
   151 
   157 
   152 _hg_addremove() {
   158 _hg_addremove() {
   153   _alternative 'files:unknown files:_hg_unknown' \
   159   _alternative 'files:unknown files:_hg_unknown' \
   154     'files:missing files:_hg_missing'
   160     'files:missing files:_hg_missing'
   301   '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
   307   '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
   302   '*:file:_files -W $(_hg_cmd root)'
   308   '*:file:_files -W $(_hg_cmd root)'
   303 }
   309 }
   304 
   310 
   305 _hg_cmd_diff() {
   311 _hg_cmd_diff() {
       
   312   typeset -A opt_args
   306   _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
   313   _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
   307   '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
   314   '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
   308   '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
   315   '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
   309   '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
   316   '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
   310   '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
   317   '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
   311   '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
   318   '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
   312   '*:file:_files -W $(_hg_cmd root)'
   319   '*:file:->diff_files'
       
   320 
       
   321   if [[ $state == 'diff_files' ]]
       
   322   then
       
   323     if [[ -n $opt_args[-r] ]]
       
   324     then
       
   325       _files -W $(_hg_cmd root)
       
   326     else
       
   327       _hg_modified
       
   328     fi
       
   329   fi
   313 }
   330 }
   314 
   331 
   315 _hg_cmd_export() {
   332 _hg_cmd_export() {
   316   _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
   333   _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
   317   '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
   334   '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
   446 _hg_cmd_revert() {
   463 _hg_cmd_revert() {
   447   _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   464   _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   448   '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
   465   '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
   449   '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
   466   '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \
   450   '--no-backup[do not save backup copies of files]' \
   467   '--no-backup[do not save backup copies of files]' \
   451   '*:file:_files -W $(_hg_cmd root)'
   468   '*:file:->diff_files'
       
   469 
       
   470   if [[ $state == 'diff_files' ]]
       
   471   then
       
   472     if [[ -n $opt_args[-r] ]]
       
   473     then
       
   474       _files -W $(_hg_cmd root)
       
   475     else
       
   476       typeset -a status_files
       
   477       _hg_status mard
       
   478       _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
       
   479     fi
       
   480   fi
   452 }
   481 }
   453 
   482 
   454 _hg_cmd_serve() {
   483 _hg_cmd_serve() {
   455   _arguments -s -w : $_hg_global_opts \
   484   _arguments -s -w : $_hg_global_opts \
   456   '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \
   485   '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \