summaryrefslogtreecommitdiff
path: root/scripts/register-completions.bash
blob: 18df8a3b77adaf4742de994c36b630b4aab6177b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# bash parameter completion for xmake

_xmake_bash_complete()
{
  local word=${COMP_WORDS[COMP_CWORD]}

  local completions
  completions="$(XMAKE_SKIP_HISTORY=1 xmake lua --root private.utils.complete "${COMP_POINT}" "conf" "${COMP_LINE}" 2>/dev/null)"
  if [ $? -ne 0 ]; then
    completions=""
  fi

  COMPREPLY=( $(compgen -W "$completions" -- "$word") )
}

complete -o default -o nospace -F _xmake_bash_complete xmake