diff options
author | Mayank Agarwal <mayankagarwal44442@gmail.com> | 2020-11-22 20:59:22 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-22 16:29:22 +0100 |
commit | 17d4cd92133bb822ff3a4f2f5bb32dfd17f99282 (patch) | |
tree | 9a91d8c7a5860acbbc82c4ee43419af09797aea2 | |
parent | 750f179aebf450db37c51e021a7b0352c7ffd42a (diff) |
docs(cli): Fix documentation about usage of deno completions script (#8369)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
-rw-r--r-- | cli/flags.rs | 18 | ||||
-rw-r--r-- | docs/getting_started/setup_your_environment.md | 32 |
2 files changed, 23 insertions, 27 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index 8cfa45e08..82fbf6541 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -814,8 +814,22 @@ fn completions_subcommand<'a, 'b>() -> App<'a, 'b> { .about("Generate shell completions") .long_about( "Output shell completion script to standard output. - deno completions bash > /usr/local/etc/bash_completion.d/deno.bash - source /usr/local/etc/bash_completion.d/deno.bash", + +bash: + deno completions bash | sudo tee /etc/bash_completion.d/deno.bash > /dev/null + source /etc/bash_completion.d/deno.bash + +zsh: + deno completions zsh |sudo tee /usr/local/share/zsh/site-functions/_deno + + Make sure to run compinit after the above command + +fish: + deno completions fish > ~/.config/fish/completions/deno.fish + +powershell: + deno completions powershell > $profile + .$profile", ) } diff --git a/docs/getting_started/setup_your_environment.md b/docs/getting_started/setup_your_environment.md index c7b051262..0d320d446 100644 --- a/docs/getting_started/setup_your_environment.md +++ b/docs/getting_started/setup_your_environment.md @@ -32,43 +32,25 @@ The supported shells are: Example (bash): ```shell -deno completions bash > /usr/local/etc/bash_completion.d/deno.bash -source /usr/local/etc/bash_completion.d/deno.bash +deno completions bash | sudo tee /etc/bash_completion.d/deno.bash > /dev/null +source /etc/bash_completion.d/deno.bash ``` -Example (zsh without framework): +Example (zsh): ```shell -mkdir ~/.zsh # create a folder to save your completions. it can be anywhere -deno completions zsh > ~/.zsh/_deno +deno completions zsh | sudo tee /usr/local/share/zsh/site-functions/_deno ``` -then add this to your `.zshrc` +Example (fish): ```shell -fpath=(~/.zsh $fpath) -autoload -Uz compinit -compinit -u +deno completions fish > ~/.config/fish/completions/deno.fish ``` -and restart your terminal. note that if completions are still not loading, you -may need to run `rm ~/.zcompdump/` to remove previously generated completions -and then `compinit` to generate them again. - -Example (zsh + oh-my-zsh) [recommended for zsh users] : - -```shell -mkdir ~/.oh-my-zsh/custom/plugins/deno -deno completions zsh > ~/.oh-my-zsh/custom/plugins/deno/_deno -``` - -After this add deno plugin under plugins tag in `~/.zshrc` file. for tools like -`antigen` path will be `~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins` and -command will be `antigen bundle deno` and so on. - Example (Powershell): -```shel +```shell deno completions powershell > $profile .$profile ``` |