Show More
@@ -8,9 +8,9 b'' | |||
|
8 | 8 | # |
|
9 | 9 | # Mercurial allows you to define additional commands through extensions. |
|
10 | 10 | # Bash should be able to automatically figure out the name of these new |
|
11 |
# commands and their options. |
|
|
12 | # complete non-option arguments, see below for how to define an | |
|
13 | # _hg_cmd_foo function. | |
|
11 | # commands and their options. See below for how to define _hg_opt_foo | |
|
12 | # and _hg_cmd_foo functions to fine-tune the completion for option and | |
|
13 | # non-option arguments, respectively. | |
|
14 | 14 | # |
|
15 | 15 | # |
|
16 | 16 | # Notes about completion for specific commands: |
@@ -34,7 +34,10 b'' | |||
|
34 | 34 | # |
|
35 | 35 | # If it exists, the function _hg_cmd_foo will be called without |
|
36 | 36 | # arguments to generate the completion candidates for the hg command |
|
37 | # "foo". | |
|
37 | # "foo". If the command receives some arguments that aren't options | |
|
38 | # even though they start with a "-", you can define a function called | |
|
39 | # _hg_opt_foo to generate the completion candidates. If _hg_opt_foo | |
|
40 | # doesn't return 0, regular completion for options is attempted. | |
|
38 | 41 | # |
|
39 | 42 | # In addition to the regular completion variables provided by bash, |
|
40 | 43 | # the following variables are also set: |
@@ -109,6 +112,7 b' shopt -s extglob' | |||
|
109 | 112 | # global options that receive an argument |
|
110 | 113 | local global_args='--cwd|-R|--repository' |
|
111 | 114 | local hg="$1" |
|
115 | local canonical=0 | |
|
112 | 116 | |
|
113 | 117 | COMPREPLY=() |
|
114 | 118 | cur="$2" |
@@ -128,6 +132,10 b' shopt -s extglob' | |||
|
128 | 132 | done |
|
129 | 133 | |
|
130 | 134 | if [[ "$cur" == -* ]]; then |
|
135 | if [ "$(type -t "_hg_opt_$cmd")" = function ] && "_hg_opt_$cmd"; then | |
|
136 | return | |
|
137 | fi | |
|
138 | ||
|
131 | 139 | opts=$("$hg" debugcomplete --options "$cmd" 2>/dev/null) |
|
132 | 140 | |
|
133 | 141 | COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$opts' -- "$cur")) |
@@ -153,7 +161,6 b' shopt -s extglob' | |||
|
153 | 161 | |
|
154 | 162 | # try to generate completion candidates for whatever command the user typed |
|
155 | 163 | local help |
|
156 | local canonical=0 | |
|
157 | 164 | if _hg_command_specific; then |
|
158 | 165 | return |
|
159 | 166 | fi |
General Comments 0
You need to be logged in to leave comments.
Login now