From d20bcf58826e76ff25d6971052b28b717e7c5ff1 Mon Sep 17 00:00:00 2001 From: Eduardo Bellido Bellido Date: Wed, 26 Oct 2016 21:27:52 +0200 Subject: [PATCH] Closes issue 809 --- plugins/available/alias-completion.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/alias-completion.plugin.bash b/plugins/available/alias-completion.plugin.bash index 75c8263f..c045c359 100644 --- a/plugins/available/alias-completion.plugin.bash +++ b/plugins/available/alias-completion.plugin.bash @@ -19,7 +19,7 @@ function alias_completion { # parse function based completion definitions, where capture group 2 => function and 3 => trigger local compl_regex='complete( +[^ ]+)* -F ([^ ]+) ("[^"]+"|[^ ]+)' # parse alias definitions, where capture group 1 => trigger, 2 => command, 3 => command arguments - local alias_regex="alias ([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'" + local alias_regex="alias( -- | )([^=]+)='(\"[^\"]+\"|[^ ]+)(( +[^ ]+)*)'" # create array of function completion triggers, keeping multi-word triggers together eval "local completions=($(complete -p | sed -Ene "/$compl_regex/s//'\3'/p"))" @@ -77,6 +77,6 @@ function alias_completion { # replace completion trigger by alias new_completion="${new_completion% *} $alias_name" echo "$new_completion" >> "$tmp_file" - done < <(alias -p | sed -Ene "s/$alias_regex/\1 '\2' '\3'/p") + done < <(alias -p | sed -Ene "s/$alias_regex/\2 '\3' '\4'/p") source "$tmp_file" && rm -f "$tmp_file" }; alias_completion