Skip to content

Commit 8238c79

Browse files
authored
Update dotnet-suggest install instructions. (#2189)
* Update dotnet-suggest install instructions. - Add 'dotnet tool install' command for 'dotnet-suggest'. - Use 'dotnet-suggest script' to obtain the shell scripts. - Use .bashrc instead of .bash_profile for the bash script. - Store the script in a separate file, and source it. - Remove script start/end comments, they are not needed if the script is installed in a file. * Update dotnet-suggest.md * Update dotnet-suggest-shim.bash * Add back the original instructions for PowerShell.
1 parent e678d32 commit 8238c79

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

docs/dotnet-suggest.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,31 @@ Command line apps built using `System.CommandLine` have built-in support for tab
77
On the machine where you'd like to enable completion, you'll need to do two things.
88

99
1. Install the `dotnet-suggest` global tool:
10-
11-
[![Nuget](https://img.shields.io/nuget/v/dotnet-suggest.svg)](https://nuget.org/packages/dotnet-suggest)
1210

13-
2. 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 appropriate `System.CommandLine`-based app.
14-
15-
* For bash, add the contents of [dotnet-suggest-shim.bash](https://github.com/dotnet/command-line-api/blob/master/src/System.CommandLine.Suggest/dotnet-suggest-shim.bash) to `~/.bash_profile`.
16-
17-
* For zsh, add the contents of [dotnet-suggest-shim.zsh](https://github.com/dotnet/command-line-api/blob/master/src/System.CommandLine.Suggest/dotnet-suggest-shim.zsh) to `~/.zshrc`.
18-
19-
* For PowerShell, add the contents of [dotnet-suggest-shim.ps1](https://github.com/dotnet/command-line-api/blob/master/src/System.CommandLine.Suggest/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:
11+
```sh
12+
dotnet tool install -g dotnet-suggest
13+
```
14+
15+
2. Install the completion script.
16+
17+
### bash
18+
```sh
19+
dotnet-suggest script bash >~/.dotnet-suggest-shim.bash
20+
echo '. ~/.dotnet-suggest-shim.bash' >>~/.bashrc
21+
```
22+
23+
### zsh
24+
```sh
25+
dotnet-suggest script zsh >~/.dotnet-suggest-shim.zsh
26+
echo '. ~/.dotnet-suggest-shim.zsh' >>~/.zshrc
27+
```
28+
29+
### PowerShell
30+
31+
Add the contents of [dotnet-suggest-shim.ps1](https://github.com/dotnet/command-line-api/blob/master/src/System.CommandLine.Suggest/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:
2032

2133
```console
2234
> echo $profile
2335
```
2436

2537
(For other shells, please [look for](https://github.com/dotnet/command-line-api/issues?q=is%3Aissue+is%3Aopen+label%3A%22shell+suggestion%22) or open an [issue](https://github.com/dotnet/command-line-api/issues).)
26-

src/System.CommandLine.Suggest/dotnet-suggest-shim.bash

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# dotnet suggest shell complete script start
21
_dotnet_bash_complete()
32
{
43
local fullpath=$(type -p "${COMP_WORDS[0]}")
@@ -27,4 +26,3 @@ _dotnet_bash_register_complete()
2726

2827
_dotnet_bash_register_complete
2928
export DOTNET_SUGGEST_SCRIPT_VERSION="1.0.3"
30-
# dotnet suggest shell complete script end

src/System.CommandLine.Suggest/dotnet-suggest-shim.zsh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# dotnet suggest shell complete script start
21
_dotnet_zsh_complete()
32
{
43
# debug lines, uncomment to get state variables passed to this function
@@ -36,4 +35,3 @@ _dotnet_zsh_complete()
3635
compdef _dotnet_zsh_complete $(dotnet-suggest list)
3736

3837
export DOTNET_SUGGEST_SCRIPT_VERSION="1.0.0"
39-
# dotnet suggest shell complete script end

0 commit comments

Comments
 (0)