File: _set_command

package info (click to toggle)
zsh-beta 4.1.0-dev-4-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,064 kB
  • ctags: 6,159
  • sloc: ansic: 73,617; sh: 4,600; makefile: 630; perl: 623; awk: 293; sed: 16
file content (31 lines) | stat: -rw-r--r-- 895 bytes parent folder | download
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