Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-crabs-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bomb.sh/tab': patch
---

fix(cli): use the globally installed version for shell completions
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ 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 permanently:

```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)

```bash
npm install @bomb.sh/tab
# or
Expand Down
10 changes: 7 additions & 3 deletions bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading