Skip to content

Commit

Permalink
Handle alias in completion script
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN committed Dec 6, 2021
1 parent 9d512fe commit 829274f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Resources/completion.bash
Expand Up @@ -9,6 +9,12 @@ _sf_{{ COMMAND_NAME }}() {
# Use newline as only separator to allow space in completion values
IFS=$'\n'
local sf_cmd="${COMP_WORDS[0]}"

# for an alias, get the real script behind it
if [[ $(type -t $sf_cmd) == "alias" ]]; then
sf_cmd=$(alias $sf_cmd | sed -E "s/alias $sf_cmd='(.*)'/\1/")
fi

if [ ! -f "$sf_cmd" ]; then
return 1
fi
Expand Down

0 comments on commit 829274f

Please sign in to comment.