Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions docs/core/tools/enable-tab-autocomplete.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,14 @@ To add tab completion to your **bash** shell for the .NET CLI, add the following
```bash
# bash parameter completion for the dotnet CLI

_dotnet_bash_complete()
function _dotnet_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local cur="${COMP_WORDS[COMP_CWORD]}" IFS=$'\n'
local candidates

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

COMPREPLY=( $(compgen -W "$completions" -- "$word") )
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]:-}" -- "$cur")
}

complete -f -F _dotnet_bash_complete dotnet
Expand Down