From add436894019c900209554e31a9bd1ff8ea219d2 Mon Sep 17 00:00:00 2001 From: Bartek Sokorski Date: Sun, 19 Jun 2022 14:31:28 +0200 Subject: [PATCH 1/5] Rework completions section in docs --- docs/_index.md | 54 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/docs/_index.md b/docs/_index.md index 971a972cce4..5450df6cdae 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -282,29 +282,39 @@ To uninstall Poetry, simply delete the entire `$VENV_PATH` directory. `poetry` supports generating completion scripts for Bash, Fish, and Zsh. See `poetry help completions` for full details, but the gist is as simple as using one of the following: +### Bash + +There are few options in `bash`, choose the one that suits your workflow. + +#### Local, recommended ```bash -# Bash -poetry completions bash > /etc/bash_completion.d/poetry +poetry completions bash >> ~/.bash_completion +``` -# Fish -poetry completions fish > ~/.config/fish/completions/poetry.fish +#### Local, based on XDG directory spec -# Zsh -poetry completions zsh > ~/.zfunc/_poetry +```bash +poetry completions bash > ${XDG_DATA_HOME:~/.local/share}/bash_completion/completions/poetry +``` -# Oh-My-Zsh -mkdir $ZSH_CUSTOM/plugins/poetry -poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry +#### Global, might require root priviledges -# prezto -poetry completions zsh > ~/.zprezto/modules/completion/external/src/_poetry +```bash +poetry completions bash > /etc/bash_completion.d/poetry +``` + +### Fish +```fish +poetry completions fish > ~/.config/fish/completions/poetry.fish ``` -{{% note %}} -You may need to restart your shell in order for the changes to take effect. -{{% /note %}} +### Zsh + +```zsh +poetry completions zsh > ~/.zfunc/_poetry +``` For `zsh`, you must then add the following lines in your `~/.zshrc` @@ -313,6 +323,12 @@ fpath+=~/.zfunc autoload -Uz compinit && compinit ``` +#### Oh-My-Zsh + +```zsh +mkdir $ZSH_CUSTOM/plugins/poetry +poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry +``` For `oh-my-zsh`, you must then enable poetry in your `~/.zshrc` plugins ```text @@ -321,3 +337,13 @@ plugins( ... ) ``` + +#### prezto + +```zsh +poetry completions zsh > ~/.zprezto/modules/completion/external/src/_poetry +``` + +{{% note %}} +You may need to restart your shell in order for the changes to take effect. +{{% /note %}} From 7223c450deb20fbe4142ce03799c72abef5ef802 Mon Sep 17 00:00:00 2001 From: Bartek Sokorski Date: Sun, 19 Jun 2022 14:38:58 +0200 Subject: [PATCH 2/5] Remove part of descriptions --- docs/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_index.md b/docs/_index.md index 5450df6cdae..0cca90036fc 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -316,7 +316,7 @@ poetry completions fish > ~/.config/fish/completions/poetry.fish poetry completions zsh > ~/.zfunc/_poetry ``` -For `zsh`, you must then add the following lines in your `~/.zshrc` +You must then add the following lines in your `~/.zshrc` ```bash fpath+=~/.zfunc @@ -329,7 +329,7 @@ autoload -Uz compinit && compinit mkdir $ZSH_CUSTOM/plugins/poetry poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry ``` -For `oh-my-zsh`, you must then enable poetry in your `~/.zshrc` plugins +You must then enable poetry in your `~/.zshrc` plugins ```text plugins( From d25d8b94193016a09337a53d1b3503d53fd6041b Mon Sep 17 00:00:00 2001 From: Bartosz Sokorski Date: Mon, 20 Jun 2022 18:35:19 +0200 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: Bjorn Neergaard --- docs/_index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/_index.md b/docs/_index.md index 0cca90036fc..cba2dd510cc 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -286,7 +286,7 @@ See `poetry help completions` for full details, but the gist is as simple as usi There are few options in `bash`, choose the one that suits your workflow. -#### Local, recommended +#### Auto-loaded (recommended) ```bash poetry completions bash >> ~/.bash_completion @@ -316,7 +316,7 @@ poetry completions fish > ~/.config/fish/completions/poetry.fish poetry completions zsh > ~/.zfunc/_poetry ``` -You must then add the following lines in your `~/.zshrc` +You must then add the following lines in your `~/.zshrc`, if they do not already exist: ```bash fpath+=~/.zfunc @@ -329,7 +329,7 @@ autoload -Uz compinit && compinit mkdir $ZSH_CUSTOM/plugins/poetry poetry completions zsh > $ZSH_CUSTOM/plugins/poetry/_poetry ``` -You must then enable poetry in your `~/.zshrc` plugins +You must then add `poetry` to your plugins array in `~/.zshrc`: ```text plugins( @@ -345,5 +345,5 @@ poetry completions zsh > ~/.zprezto/modules/completion/external/src/_poetry ``` {{% note %}} -You may need to restart your shell in order for the changes to take effect. +You may need to restart your shell in order for these changes to take effect. {{% /note %}} From e7d5d881798ccc665df493b698061e781acf16e2 Mon Sep 17 00:00:00 2001 From: Bartosz Sokorski Date: Mon, 20 Jun 2022 18:36:05 +0200 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Bjorn Neergaard --- docs/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/_index.md b/docs/_index.md index cba2dd510cc..2c4b351d3e3 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -292,7 +292,7 @@ There are few options in `bash`, choose the one that suits your workflow. poetry completions bash >> ~/.bash_completion ``` -#### Local, based on XDG directory spec +#### Lazy-loaded ```bash poetry completions bash > ${XDG_DATA_HOME:~/.local/share}/bash_completion/completions/poetry @@ -323,7 +323,7 @@ fpath+=~/.zfunc autoload -Uz compinit && compinit ``` -#### Oh-My-Zsh +#### Oh My Zsh ```zsh mkdir $ZSH_CUSTOM/plugins/poetry From bed7157e8c96f9c00f9392889cb05c070e142c69 Mon Sep 17 00:00:00 2001 From: Bartek Sokorski Date: Mon, 20 Jun 2022 18:37:47 +0200 Subject: [PATCH 5/5] Apply suggested changes --- docs/_index.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docs/_index.md b/docs/_index.md index 2c4b351d3e3..dd0bb65275c 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -284,8 +284,6 @@ See `poetry help completions` for full details, but the gist is as simple as usi ### Bash -There are few options in `bash`, choose the one that suits your workflow. - #### Auto-loaded (recommended) ```bash @@ -298,12 +296,6 @@ poetry completions bash >> ~/.bash_completion poetry completions bash > ${XDG_DATA_HOME:~/.local/share}/bash_completion/completions/poetry ``` -#### Global, might require root priviledges - -```bash -poetry completions bash > /etc/bash_completion.d/poetry -``` - ### Fish ```fish