##// END OF EJS Templates
zsh completion: add new option groups for options...
Nikolaj Sjujskij -
r17398:b290d3b1 default
parent child Browse files
Show More
@@ -398,18 +398,49 b' typeset -A _hg_cmd_globals'
398 398 '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/'
399 399 '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/')
400 400
401 _hg_clone_opts=(
402 $_hg_remote_opts
403 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]'
404 '--pull[use pull protocol to copy metadata]'
405 '--uncompressed[use uncompressed transfer (fast over LAN)]')
406
407 _hg_date_user_opts=(
408 '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]'
409 '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]'
410 '(--date -d)'{-d+,--date}'[record the specified date as commit date]:date:'
411 '(--user -u)'{-u+,--user}'[record the specified user as committer]:user:')
412
413 _hg_gitlike_opts=(
414 '(--git -g)'{-g,--git}'[use git extended diff format]')
415
401 416 _hg_diff_opts=(
417 $_hg_gitlike_opts
402 418 '(--text -a)'{-a,--text}'[treat all files as text]'
403 '(--git -g)'{-g,--git}'[use git extended diff format]'
404 "--nodates[omit dates from diff headers]")
419 '--nodates[omit dates from diff headers]')
420
421 _hg_mergetool_opts=(
422 '(--tool -t)'{-t+,--tool}'[specify merge tool]:tool:')
405 423
406 424 _hg_dryrun_opts=(
407 425 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
408 426
427 _hg_ignore_space_opts=(
428 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]'
429 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]'
430 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]')
431
409 432 _hg_style_opts=(
410 433 '--style[display using template map file]:'
411 434 '--template[display with template]:')
412 435
436 _hg_log_opts=(
437 $_hg_global_opts $_hg_style_opts $_hg_gitlike_opts
438 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:'
439 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]'
440 '(--patch -p)'{-p,--patch}'[show patch]'
441 '--stat[output diffstat-style summary of changes]'
442 )
443
413 444 _hg_commit_opts=(
414 445 '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
415 446 '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:'
@@ -419,6 +450,11 b' typeset -A _hg_cmd_globals'
419 450 '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:'
420 451 '--remotecmd[specify hg command to run on the remote side]:')
421 452
453 _hg_branch_bmark_opts=(
454 '(--bookmark -B)'{-B+,--bookmark}'[specify bookmark(s)]:bookmark:_hg_bookmarks'
455 '(--branch -b)'{-b+,--branch}'[specify branch(es)]:branch:_hg_branches'
456 )
457
422 458 _hg_cmd() {
423 459 _call_program hg HGPLAIN=1 hg "$_hg_cmd_globals[@]" "$@" 2> /dev/null
424 460 }
@@ -456,7 +492,7 b' typeset -A _hg_cmd_globals'
456 492 }
457 493
458 494 _hg_cmd_backout() {
459 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
495 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
460 496 '--merge[merge with old dirstate parent after backout]' \
461 497 '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \
462 498 '--parent[parent to choose when backing out merge]' \
@@ -512,7 +548,7 b' typeset -A _hg_cmd_globals'
512 548 }
513 549
514 550 _hg_cmd_clone() {
515 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
551 _arguments -s -w : $_hg_global_opts $_hg_clone_opts \
516 552 '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
517 553 '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \
518 554 '--uncompressed[use uncompressed transfer (fast over LAN)]' \
@@ -540,12 +576,10 b' typeset -A _hg_cmd_globals'
540 576
541 577 _hg_cmd_diff() {
542 578 typeset -A opt_args
543 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
579 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
580 $_hg_diff_opts $_hg_ignore_space_opts \
544 581 '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \
545 582 '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
546 '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
547 '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
548 '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
549 583 '*:file:->diff_files'
550 584
551 585 if [[ $state == 'diff_files' ]]
@@ -572,16 +606,11 b' typeset -A _hg_cmd_globals'
572 606 }
573 607
574 608 _hg_cmd_graft() {
575 _arguments -s -w : $_hg_global_opts \
609 _arguments -s -w : $_hg_global_opts $_hg_dryrun_opts \
610 $_hg_date_user_opts $_hg_mergetool_opts \
576 611 '(--continue -c)'{-c,--continue}'[resume interrupted graft]' \
577 612 '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
578 613 '--log[append graft info to log message]' \
579 '(--currentdate -D)'{-D,--currentdate}'[record the current date as commit date]' \
580 '(--currentuser -U)'{-U,--currentuser}'[record the current user as committer]' \
581 '(--date -d)'{-d,--date}'[record the specified date as commit date]' \
582 '(--user -u)'{-u,--user}'[record the specified user as committer]' \
583 '(--tool -t)'{-t,--tool}'[specify merge tool]' \
584 '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]' \
585 614 '*:revision:_hg_labels'
586 615 }
587 616
@@ -610,7 +639,7 b' typeset -A _hg_cmd_globals'
610 639 }
611 640
612 641 _hg_cmd_identify() {
613 _arguments -s -w : $_hg_global_opts \
642 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
614 643 '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_labels' \
615 644 '(--num -n)'{-n+,--num}'[show local revision number]' \
616 645 '(--id -i)'{-i+,--id}'[show global revision id]' \
@@ -619,19 +648,16 b' typeset -A _hg_cmd_globals'
619 648 }
620 649
621 650 _hg_cmd_import() {
622 _arguments -s -w : $_hg_global_opts \
651 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
623 652 '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \
624 '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \
625 653 '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
626 654 '--bypass[apply patch without touching the working directory]' \
627 655 '*:patch:_files'
628 656 }
629 657
630 658 _hg_cmd_incoming() {
631 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
632 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
659 _arguments -s -w : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \
633 660 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
634 '(--patch -p)'{-p,--patch}'[show patch]' \
635 661 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \
636 662 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
637 663 '--bundle[file to store the bundles into]:bundle file:_files' \
@@ -652,16 +678,13 b' typeset -A _hg_cmd_globals'
652 678 }
653 679
654 680 _hg_cmd_log() {
655 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
681 _arguments -s -w : $_hg_log_opts $_hg_pat_opts \
656 682 '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
657 683 '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
658 684 '(--copies -C)'{-C,--copies}'[show copied files]' \
659 685 '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \
660 '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \
661 686 '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
662 '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
663 687 '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
664 '(--patch -p)'{-p,--patch}'[show patch]' \
665 688 '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_labels' \
666 689 '(--branch -b)'{-b+,--branch}'[show changesets within the given named branch]:branch:_hg_branches' \
667 690 '*:files:_hg_files'
@@ -674,19 +697,16 b' typeset -A _hg_cmd_globals'
674 697 }
675 698
676 699 _hg_cmd_merge() {
677 _arguments -s -w : $_hg_global_opts \
700 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts \
678 701 '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
679 702 '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
680 703 '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
681 '(--tool -t)'{-t,--tool}'[specify merge tool]' \
682 704 ':revision:_hg_mergerevs'
683 705 }
684 706
685 707 _hg_cmd_outgoing() {
686 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
687 '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
708 _arguments -s -w : $_hg_log_opts $_hg_branch_bmark_opts $_hg_remote_opts \
688 709 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
689 '(--patch -p)'{-p,--patch}'[show patch]' \
690 710 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \
691 711 '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
692 712 ':destination:_hg_remote'
@@ -714,7 +734,7 b' typeset -A _hg_cmd_globals'
714 734 }
715 735
716 736 _hg_cmd_pull() {
717 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
737 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_branch_bmark_opts \
718 738 '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
719 739 '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
720 740 '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \
@@ -722,7 +742,7 b' typeset -A _hg_cmd_globals'
722 742 }
723 743
724 744 _hg_cmd_push() {
725 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
745 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_branch_bmark_opts \
726 746 '(--force -f)'{-f,--force}'[force push]' \
727 747 '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_labels' \
728 748 ':destination:_hg_remote'
@@ -746,7 +766,7 b' typeset -A _hg_cmd_globals'
746 766 local context state line
747 767 typeset -A opt_args
748 768
749 _arguments -s -w : $_hg_global_opts \
769 _arguments -s -w : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
750 770 '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
751 771 '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
752 772 '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
@@ -840,7 +860,7 b' typeset -A _hg_cmd_globals'
840 860 }
841 861
842 862 _hg_cmd_tip() {
843 _arguments -s -w : $_hg_global_opts $_hg_style_opts \
863 _arguments -s -w : $_hg_global_opts $_hg_gitlike_opts $_hg_style_opts \
844 864 '(--patch -p)'{-p,--patch}'[show patch]'
845 865 }
846 866
@@ -927,7 +947,8 b' typeset -A _hg_cmd_globals'
927 947 }
928 948
929 949 _hg_cmd_qdiff() {
930 _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
950 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
951 $_hg_ignore_space_opts \
931 952 '*:pattern:_hg_files'
932 953 }
933 954
@@ -963,7 +984,7 b' typeset -A _hg_cmd_globals'
963 984 }
964 985
965 986 _hg_cmd_qimport() {
966 _arguments -s -w : $_hg_global_opts \
987 _arguments -s -w : $_hg_global_opts $_hg_gitlike_opts \
967 988 '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
968 989 '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \
969 990 '(--force -f)'{-f,--force}'[overwrite existing files]' \
@@ -973,6 +994,7 b' typeset -A _hg_cmd_globals'
973 994
974 995 _hg_cmd_qnew() {
975 996 _arguments -s -w : $_hg_global_opts $_hg_commit_opts \
997 $_hg_date_user_opts $_hg_gitlike_opts \
976 998 '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
977 999 ':patch:'
978 1000 }
@@ -1006,7 +1028,7 b' typeset -A _hg_cmd_globals'
1006 1028 }
1007 1029
1008 1030 _hg_cmd_qrefresh() {
1009 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
1031 _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts $_hg_gitlike_opts \
1010 1032 '(--git -g)'{-g,--git}'[use git extended diff format]' \
1011 1033 '(--short -s)'{-s,--short}'[short refresh]' \
1012 1034 '*:files:_hg_files'
@@ -1050,8 +1072,7 b' typeset -A _hg_cmd_globals'
1050 1072
1051 1073 # Patchbomb
1052 1074 _hg_cmd_email() {
1053 _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
1054 '(--git -g)'{-g,--git}'[use git extended diff format]' \
1075 _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_gitlike_opts \
1055 1076 '--plain[omit hg patch header]' \
1056 1077 '--body[send patches as inline message text (default)]' \
1057 1078 '(--outgoing -o)'{-o,--outgoing}'[send changes not found in the target repository]' \
@@ -1081,18 +1102,14 b' typeset -A _hg_cmd_globals'
1081 1102
1082 1103 # Rebase
1083 1104 _hg_cmd_rebase() {
1084 _arguments -s -w : $_hg_global_opts \
1105 _arguments -s -w : $_hg_global_opts $_hg_commit_opts $_hg_mergetool_opts \
1085 1106 '*'{-r,--rev}'[rebase these revisions]:revision:_hg_revrange' \
1086 1107 '(--source -s)'{-s,--source}'[rebase from the specified changeset]:revision:_hg_labels' \
1087 1108 '(--base -b)'{-b,--base}'[rebase from the base of the specified changeset]:revision:_hg_labels' \
1088 1109 '(--dest -d)'{-d,--dest}'[rebase onto the specified changeset]' \
1089 1110 '--collapse[collapse the rebased changeset]' \
1090 '(--message -m)'{-m+,--message}'[use <text> as collapse commit message]:text:' \
1091 '(--edit -e)'{-e,--edit}'[invoke editor on commit messages]' \
1092 '(--logfile -l)'{-l+,--logfile}'[read collapse commit message from <file>]:log file:_files -g \*.txt' \
1093 1111 '--keep[keep original changeset]' \
1094 1112 '--keepbranches[keep original branch name]' \
1095 '(--tool -t)'{-t,--tool}'[specify merge tool]' \
1096 1113 '(--continue -c)'{-c,--continue}'[continue an interrupted rebase]' \
1097 1114 '(--abort -a)'{-a,--abort}'[abort an interrupted rebase]' \
1098 1115 }
General Comments 0
You need to be logged in to leave comments. Login now