Merge pull request #2042 from gaelicWizard/completion/dotnet

completion/dotnet: new completion
This commit is contained in:
Noah Gorny
2022-01-25 18:16:06 +02:00
committed by GitHub
2 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
# shellcheck shell=bash
about-completion "bash parameter completion for the dotnet CLI"
# see https://docs.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#bash
function _dotnet_bash_complete() {
local cur="${COMP_WORDS[COMP_CWORD]}" IFS=$'\n'
local candidates
read -d '' -ra candidates < <(dotnet complete --position "${COMP_POINT}" "${COMP_LINE}" 2> /dev/null)
read -d '' -ra COMPREPLY < <(compgen -W "${candidates[*]:-}" -- "$cur")
}
complete -f -F _dotnet_bash_complete dotnet