mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
bash_completion: determine root executable in case of alias
This solves an issue for users that have "alias hg='hg --some_opts'" where they would see wrong entries in the completion output (such as color codes).
This commit is contained in:
parent
728e53206c
commit
46fae822f1
@ -130,12 +130,19 @@ _hg_count_non_option()
|
||||
|
||||
_hg()
|
||||
{
|
||||
local cur prev cmd cmd_index opts i
|
||||
local cur prev cmd cmd_index opts i aliashg
|
||||
# global options that receive an argument
|
||||
local global_args='--cwd|-R|--repository'
|
||||
local hg="$1"
|
||||
local canonical=0
|
||||
|
||||
aliashg=$(alias $hg 2>/dev/null)
|
||||
if [[ -n "$aliashg" ]]; then
|
||||
aliashg=${aliashg#"alias $hg='"}
|
||||
aliashg=${aliashg%"'"}
|
||||
hg=$aliashg
|
||||
fi
|
||||
|
||||
COMPREPLY=()
|
||||
cur="$2"
|
||||
prev="$3"
|
||||
|
Loading…
Reference in New Issue
Block a user