Command line apps built using System.CommandLine
have built-in support for tab completion.
On the machine where you'd like to enable completion, you'll need to do two things.
- Install the
dotnet-suggest
global tool:
dotnet tool install -g dotnet-suggest
- Install the completion script.
dotnet-suggest script bash >~/.dotnet-suggest-shim.bash
echo '. ~/.dotnet-suggest-shim.bash' >>~/.bashrc
dotnet-suggest script zsh >~/.dotnet-suggest-shim.zsh
echo '. ~/.dotnet-suggest-shim.zsh' >>~/.zshrc
Add the contents of dotnet-suggest-shim.ps1 to your PowerShell profile. You can find the expected path to your PowerShell profile by running the following in your console:
> echo $profile