File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @bomb.sh/tab ' : patch
3+ ---
4+
5+ fix(cli): use the globally installed version for shell completions
Original file line number Diff line number Diff line change @@ -14,6 +14,28 @@ 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 permanently:
24+
25+ ``` bash
26+ # For zsh
27+ echo ' source <(tab pnpm zsh)' >> ~ /.zshrc
28+ source ~ /.zshrc
29+
30+ # For bash
31+ echo ' source <(tab pnpm bash)' >> ~ /.bashrc
32+ source ~ /.bashrc
33+
34+ # The same can be done for other shells!
35+ ```
36+
37+ ### For CLI Library (Adding Completions to Your CLI)
38+
1739``` bash
1840npm install @bomb.sh/tab
1941# or
Original file line number Diff line number Diff line change @@ -64,9 +64,13 @@ async function main() {
6464
6565function 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
You can’t perform that action at this time.
0 commit comments