summarylogtreecommitdiffstats
path: root/register-completions.bash
blob: 1dd65095e1cbcda9e74ab4399a144b21198f6d8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# bash parameter completion for the dotnet CLI

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

  local completions
  completions="$(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2>/dev/null)"
  if [ $? -ne 0 ]; then
    completions=""
  fi

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

complete -f -F _dotnet_bash_complete dotnet