From d5d2cf75f67186aff6a9d003143b45581e32466b Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Mon, 3 Nov 2025 10:36:51 +0330 Subject: [PATCH 1/3] global install tab --- README.md | 15 +++++++++++++++ bin/cli.ts | 10 +++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 88a011e..a6286ab 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,21 @@ tab solves this complexity by providing autocompletions that work consistently a ## Installation +### For Package Manager Completions (Global install is recommended) + +```bash +npm install -g @bomb.sh/tab +``` + +Then enable completions: + +```bash +source <(tab pnpm zsh) # for zsh +source <(tab pnpm bash) # for bash +``` + +### For CLI Library (Adding Completions to Your CLI) + ```bash npm install @bomb.sh/tab # or diff --git a/bin/cli.ts b/bin/cli.ts index 7b95012..b860f22 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -64,9 +64,13 @@ async function main() { function generateCompletionScript(packageManager: string, shell: string) { const name = packageManager; - const executable = process.env.npm_config_user_agent - ? `npx --yes @bomb.sh/tab ${packageManager}` - : `node ${process.argv[1]} ${packageManager}`; + + const isLocalDev = process.argv[1].endsWith('dist/bin/cli.js'); + + const executable = isLocalDev + ? `node ${process.argv[1]} ${packageManager}` + : `tab ${packageManager}`; + script(shell as any, name, executable); } From f533f85198abee01eead72747ca3f5b01c03e115 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Mon, 3 Nov 2025 17:40:43 +0330 Subject: [PATCH 2/3] readme --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a6286ab..28cccb1 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,18 @@ tab solves this complexity by providing autocompletions that work consistently a npm install -g @bomb.sh/tab ``` -Then enable completions: +Then enable completions permanently: ```bash -source <(tab pnpm zsh) # for zsh -source <(tab pnpm bash) # for bash +# For zsh +echo 'source <(tab pnpm zsh)' >> ~/.zshrc +source ~/.zshrc + +# For bash +echo 'source <(tab pnpm bash)' >> ~/.bashrc +source ~/.bashrc + +# The same can be done for other shells! ``` ### For CLI Library (Adding Completions to Your CLI) From 9b29b9a460e7cf3cdd123307f87fae67991ee606 Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Mon, 3 Nov 2025 17:54:19 +0330 Subject: [PATCH 3/3] changeset --- .changeset/lemon-crabs-bathe.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lemon-crabs-bathe.md diff --git a/.changeset/lemon-crabs-bathe.md b/.changeset/lemon-crabs-bathe.md new file mode 100644 index 0000000..d2acde3 --- /dev/null +++ b/.changeset/lemon-crabs-bathe.md @@ -0,0 +1,5 @@ +--- +'@bomb.sh/tab': patch +--- + +fix(cli): use the globally installed version for shell completions