##// END OF EJS Templates
Use user specified path to hg in bash_completion...
Thomas Arendsen Hein -
r1683:063e0483 default
parent child Browse files
Show More
@@ -2,7 +2,7 b' shopt -s extglob'
2
2
3 _hg_command_list()
3 _hg_command_list()
4 {
4 {
5 hg --debug help 2>/dev/null | \
5 "$hg" --debug help 2>/dev/null | \
6 awk 'function command_line(line) {
6 awk 'function command_line(line) {
7 gsub(/,/, "", line)
7 gsub(/,/, "", line)
8 gsub(/:.*/, "", line)
8 gsub(/:.*/, "", line)
@@ -24,7 +24,7 b' shopt -s extglob'
24
24
25 _hg_option_list()
25 _hg_option_list()
26 {
26 {
27 hg -v help $1 2> /dev/null | \
27 "$hg" -v help $1 2> /dev/null | \
28 awk '/^ *-/ {
28 awk '/^ *-/ {
29 for (i = 1; i <= NF; i ++) {
29 for (i = 1; i <= NF; i ++) {
30 if (index($i, "-") != 1)
30 if (index($i, "-") != 1)
@@ -56,7 +56,7 b' shopt -s extglob'
56
56
57 _hg_paths()
57 _hg_paths()
58 {
58 {
59 local paths="$(hg paths 2> /dev/null | sed -e 's/ = .*$//')"
59 local paths="$("$hg" paths 2> /dev/null | sed -e 's/ = .*$//')"
60 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$paths' -- "$cur" ))
60 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$paths' -- "$cur" ))
61 }
61 }
62
62
@@ -70,13 +70,13 b' shopt -s extglob'
70
70
71 _hg_status()
71 _hg_status()
72 {
72 {
73 local files="$( hg status -n$1 . 2> /dev/null)"
73 local files="$( "$hg" status -n$1 . 2> /dev/null)"
74 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$files' -- "$cur" ))
74 COMPREPLY=(${COMPREPLY[@]:-} $( compgen -W '$files' -- "$cur" ))
75 }
75 }
76
76
77 _hg_tags()
77 _hg_tags()
78 {
78 {
79 local tags="$(hg tags 2> /dev/null |
79 local tags="$("$hg" tags 2> /dev/null |
80 sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
80 sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')"
81 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") )
81 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") )
82 }
82 }
@@ -104,6 +104,7 b' shopt -s extglob'
104 local cur prev cmd opts i
104 local cur prev cmd opts i
105 # global options that receive an argument
105 # global options that receive an argument
106 local global_args='--cwd|-R|--repository'
106 local global_args='--cwd|-R|--repository'
107 local hg="$1"
107
108
108 COMPREPLY=()
109 COMPREPLY=()
109 cur="$2"
110 cur="$2"
@@ -146,7 +147,7 b' shopt -s extglob'
146 fi
147 fi
147
148
148 # canonicalize command name
149 # canonicalize command name
149 cmd=$(hg -q help "$cmd" 2> /dev/null | sed -e 's/^hg //; s/ .*//; 1q')
150 cmd=$("$hg" -q help "$cmd" 2> /dev/null | sed -e 's/^hg //; s/ .*//; 1q')
150
151
151 if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then
152 if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then
152 _hg_tags
153 _hg_tags
General Comments 0
You need to be logged in to leave comments. Login now