-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
cli/subsvcdotnet-fundamentals/svchelp wantedGood for community contributors to help [up-for-grabs]Good for community contributors to help [up-for-grabs]
Description
I would suggest a slightly more modern formulation for the completion:
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")
}
This uses a more familiar convention to many programmable completion functions for Bash, is more idiomatic Bash, and avoids unexpected word-splitting by being explicit about it: use read -ra
to populate the array parameter, with IFS=$'\n'
and -d ''
.
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: 341f0255-aa31-8e76-9b17-1232b7a910a9
- Version Independent ID: f30f63dc-0d90-7dba-ef39-b0148c637c1a
- Content: Enable tab completion - .NET CLI
- Content Source: docs/core/tools/enable-tab-autocomplete.md
- Product: dotnet-fundamentals
- Technology: dotnet-cli
- GitHub Login: @adegeo
- Microsoft Alias: adegeo
Metadata
Metadata
Assignees
Labels
cli/subsvcdotnet-fundamentals/svchelp wantedGood for community contributors to help [up-for-grabs]Good for community contributors to help [up-for-grabs]