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: -
Add the appropriate shim script to your shell profile. You may have to create a shell profile file. The shim script will forward completion requests from your shell to the
dotnet-suggest
tool, which delegates to the appropriateSystem.CommandLine
-based app.-
For bash, add the contents of dotnet-suggest-shim.bash to
~/.bash_profile
. -
For PowerShell, 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