about summary refs log tree commit diff
path: root/Completion/Base/_command_names
blob: a0ec9026261472070fa7f57ce5cef85b5390791c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#compdef -command-

local nm=$compstate[nmatches] ret=1 expl


# Complete jobs in implicit fg and bg
if [[ "$PREFIX[1]" = "%" ]]; then
  _description expl job
  compgen "$expl[@]" -j -P '%'
  [[ nm -ne compstate[nmatches] ]] && return
fi

_description expl command
compgen "$expl[@]" -c && ret=0

if [[ nm -eq compstate[nmatches] ]]; then
  _description expl 'executable file or directory'
  _path_files "$expl[@]" -/g "*(*)"
else
  return ret
fi