Mercurial > hg
comparison contrib/bash_completion @ 1643:747c8d03bd29
bash_completion: ignore hg help error messages
They are usually not useful when you're completing stuff and end up
cluttering the screen.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 27 Jan 2006 12:15:39 +0100 |
parents | b8d792057e5b |
children | 063e04831a09 |
comparison
equal
deleted
inserted
replaced
1642:b8d792057e5b | 1643:747c8d03bd29 |
---|---|
54 COMPREPLY=(${COMPREPLY[@]:-} $result) | 54 COMPREPLY=(${COMPREPLY[@]:-} $result) |
55 } | 55 } |
56 | 56 |
57 _hg_paths() | 57 _hg_paths() |
58 { | 58 { |
59 local paths="$(hg paths | 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 |
63 _hg_repos() | 63 _hg_repos() |
64 { | 64 { |
68 done | 68 done |
69 } | 69 } |
70 | 70 |
71 _hg_status() | 71 _hg_status() |
72 { | 72 { |
73 local files="$( hg status -n$1 . )" | 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 | sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')" | 79 local tags="$(hg tags 2> /dev/null | |
80 sed -e 's/[0-9]*:[a-f0-9]\{40\}$//; s/ *$//')" | |
80 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") ) | 81 COMPREPLY=( ${COMPREPLY[@]:-} $(compgen -W '$tags' -- "$cur") ) |
81 } | 82 } |
82 | 83 |
83 # this is "kind of" ugly... | 84 # this is "kind of" ugly... |
84 _hg_count_non_option() | 85 _hg_count_non_option() |
143 _hg_commands | 144 _hg_commands |
144 return | 145 return |
145 fi | 146 fi |
146 | 147 |
147 # canonicalize command name | 148 # canonicalize command name |
148 cmd=$(hg -q help "$cmd" | sed -e 's/^hg //; s/ .*//; 1q') | 149 cmd=$(hg -q help "$cmd" 2> /dev/null | sed -e 's/^hg //; s/ .*//; 1q') |
149 | 150 |
150 if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then | 151 if [ "$cmd" != status ] && [ "$prev" = -r ] || [ "$prev" = --rev ]; then |
151 _hg_tags | 152 _hg_tags |
152 return | 153 return |
153 fi | 154 fi |