From a2df2f6c1d101a29dedbe9b3778a8abe76236271 Mon Sep 17 00:00:00 2001 From: khai96_ Date: Wed, 7 Feb 2024 16:35:19 +0700 Subject: [PATCH] docs: completion --- docs/cli/completion.md | 32 ++++++++++++++++++++++++++++++++ sidebars.json | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 docs/cli/completion.md diff --git a/docs/cli/completion.md b/docs/cli/completion.md new file mode 100644 index 000000000000..eca3eef10588 --- /dev/null +++ b/docs/cli/completion.md @@ -0,0 +1,32 @@ +--- +id: completion +title: pnpm completion +--- + +Print shell completion code to stdout. + +```text +pnpm completion +``` + +## Parameters + +### <shell> + +Shell to print completion code for. Only 4 shells are supported: `bash`, `fish`, `pwsh`, `zsh`. + +## Examples + +### Activate completion for Bash by sourcing it from ~/.bashrc + +```bash +pnpm completion bash > ~/completion-for-pnpm.bash +echo 'source ~/completion-for-pnpm.bash' >> ~/.bashrc +``` + +### Install completion for Bash directly to its completion directory (for installing pnpm as a Linux distro package) + +```bash +mkdir -p /usr/share/bash-completion/completions/ +pnpm completion bash > /usr/share/bash-completion/completions/pnpm +``` diff --git a/sidebars.json b/sidebars.json index d256b20c5f9d..5e2f4d3f9d40 100644 --- a/sidebars.json +++ b/sidebars.json @@ -83,7 +83,8 @@ "cli/init", "cli/deploy", "cli/doctor", - "cli/config" + "cli/config", + "cli/completion" ] } ],