Skip to content

Commit d5d2cf7

Browse files
committed
global install tab
1 parent 5d9340d commit d5d2cf7

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ tab solves this complexity by providing autocompletions that work consistently a
1414

1515
## Installation
1616

17+
### For Package Manager Completions (Global install is recommended)
18+
19+
```bash
20+
npm install -g @bomb.sh/tab
21+
```
22+
23+
Then enable completions:
24+
25+
```bash
26+
source <(tab pnpm zsh) # for zsh
27+
source <(tab pnpm bash) # for bash
28+
```
29+
30+
### For CLI Library (Adding Completions to Your CLI)
31+
1732
```bash
1833
npm install @bomb.sh/tab
1934
# or

bin/cli.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ async function main() {
6464

6565
function generateCompletionScript(packageManager: string, shell: string) {
6666
const name = packageManager;
67-
const executable = process.env.npm_config_user_agent
68-
? `npx --yes @bomb.sh/tab ${packageManager}`
69-
: `node ${process.argv[1]} ${packageManager}`;
67+
68+
const isLocalDev = process.argv[1].endsWith('dist/bin/cli.js');
69+
70+
const executable = isLocalDev
71+
? `node ${process.argv[1]} ${packageManager}`
72+
: `tab ${packageManager}`;
73+
7074
script(shell as any, name, executable);
7175
}
7276

0 commit comments

Comments
 (0)