blob: daf5326867371255644b566c822a037ec6fad368 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#autoload
# This sets the parameters _comp_command1 and _comp_command2 in the
# calling function.
local command
command="$words[1]"
[[ -z "$command" ]] && return
if (( $+builtins[$command] + $+functions[$command] )); then
_comp_command1="$command"
curcontext="${curcontext%:*:*}:${_comp_command1}:"
elif [[ "$command[1]" = '=' ]]; then
eval _comp_command2\=$command
_comp_command1="$command[2,-1]"
curcontext="${curcontext%:*:*}:${_comp_command2}:"
elif [[ "$command" = ..#/* ]]; then
_comp_command1="${PWD}/$command"
_comp_command2="${command:t}"
curcontext="${curcontext%:*:*}:${_comp_command2}:"
elif [[ "$command" = */* ]]; then
_comp_command1="$command"
_comp_command2="${command:t}"
curcontext="${curcontext%:*:*}:${_comp_command2}:"
else
_comp_command1="$command"
_comp_command2="$commands[$command]"
curcontext="${curcontext%:*:*}:${_comp_command1}:"
fi
|