about summary refs log tree commit diff
path: root/Completion/Core/_wanted
blob: 2303322d4bd037501e103b009837771d9d03dd0f (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
32
33
#autoload

local targs gopt=-J

if [[ "$1" = -C?* ]]; then
  targs=( -C "${1[3,-1]}" )
  shift
elif [[ "$1" = -C ]]; then
  targs=( -C "$2" )
  shift 2
else
  targs=()
fi

if [[ "$1" = -([12]|)[VJ] ]]; then
  gopt="$1"
  shift
fi

if [[ $# -gt 3 ]]; then
  if _tags "$targs[@]" "$1"; then
    _comp_tags="$_comp_tags $1"

    _loop -t "$gopt" "$@"
  else
    return 1
  fi
elif [[ $# -gt 1 ]]; then
  _tags -- "$targs[@]" "$1" && _comp_tags="$_comp_tags $1" &&
    _description "$gopt" "$@"
else
  _tags -- "$targs[@]" "$1" && _comp_tags="$_comp_tags $1"
fi