Skip to content

Commit 18814e6

Browse files
committed
grammar issues
1 parent 00e485c commit 18814e6

File tree

1 file changed

+41
-28
lines changed

1 file changed

+41
-28
lines changed

README.2.md

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
> a video showcasing how pnpm autocompletions works on a test cli command like `my-cli`
1+
> A video showcasing how pnpm autocompletions work on a test CLI command like `my-cli`
22
33
# tab
44

5-
> instant feedback when hitting [TAB] in your cli tool
5+
> Instant feedback for your CLI tool when hitting [TAB] in your terminal
66
7-
as cli tooling authors, if we can spare our users a second or two by not checking the documentation or writing the `-h` option, we're doing them a huge favor. the unconscious loves hitting the [TAB] key. it always expects feedback. so it feels dissappointing when hitting that key in the terminal but then nothing happens. that frustration is apparent across the whole javascript cli tooling ecosystem.
7+
As CLI tooling authors, if we can spare our users a second or two by not checking the documentation or writing the `-h` option, we're doing them a huge favor. The unconscious loves hitting the [TAB] key. It always expects feedback. So it feels disappointing when hitting that key in the terminal but then nothing happens. That frustration is apparent across the whole JavaScript CLI tooling ecosystem.
88

9-
autocompletions are the solution to not break the user's flow. the issue is they're not simple to add. `zsh` expects them in a way, and `bash` in another way. then where do we provide them so the shell environment parses them? too many headaches to ease the user's experience. whether it's worth it or not is out of the question. because tab is the solution to this complexity.
9+
Autocompletions are the solution to not break the user's flow. The issue is they're not simple to add. `zsh` expects them in one way, and `bash` in another way. Then where do we provide them so the shell environment parses them? Too many headaches to ease the user's experience. Whether it's worth it or not is out of the question. Because tab is the solution to this complexity.
1010

1111
`my-cli.ts`:
1212
```typescript
@@ -26,7 +26,7 @@ if (process.argv[2] === 'complete') {
2626
}
2727
```
2828

29-
this `my-cli.ts` would be equipped with all the tools required to provide autocompletions.
29+
This `my-cli.ts` would be equipped with all the tools required to provide autocompletions.
3030

3131
```bash
3232
node my-cli.ts complete -- "st"
@@ -36,57 +36,70 @@ start start the development server
3636
:0
3737
```
3838

39-
this output was generated by the `t.parse` method to autocomplete "st" to "start".
39+
This output was generated by the `t.parse` method to autocomplete "st" to "start".
4040

41-
obviously, the user won't be running that command directly in their terminal. they'd be running something like this.
41+
Obviously, the user won't be running that command directly in their terminal. They'd be running something like this.
4242

4343
```bash
4444
source <(node my-cli.ts complete zsh)
4545
```
4646

47-
now whenever the shell sees `my-cli`, it would bring the autocompletions we wrote for this cli tool. the `node my-cli.ts complete zsh` part would output the zsh script that loads the autocompletions provided by `t.parse` which then would be executed using `source`.
47+
Now whenever the shell sees `my-cli`, it would bring the autocompletions we wrote for this CLI tool. The `node my-cli.ts complete zsh` part would output the zsh script that loads the autocompletions provided by `t.parse` which then would be executed using `source`.
4848

49-
the autocompletions are only lived through the current session. to set them up across all of terminal sessions, the autocompletion script should be injected in the `.zshrc` file.
49+
The autocompletions only live through the current shell session. To set them up across all terminal sessions, the autocompletion script should be injected in the `.zshrc` file.
5050

5151
```bash
5252
my-cli complete zsh > ~/completion-for-my-cli.zsh && echo 'source ~/completion-for-my-cli.zsh' >> ~/.zshrc
5353
```
5454

55-
this is an example of autocompletions on a global cli command that is usually installed using the `-g` flag (e.g. `npm add -g my-cli`) which is available across the computer.
55+
Or
56+
57+
```bash
58+
echo 'source <(npx --offline my-cli complete zsh)' >> ~/.zshrc
59+
```
60+
61+
This is an example of autocompletions on a global CLI command that is usually installed using the `-g` flag (e.g. `npm add -g my-cli`) which is available across the computer.
5662

5763
---
5864

59-
while working on tab, we came to the realization that most javascript clis are not global cli commands but rather, per-project dependencies.
65+
While working on tab, we came to the realization that most JavaScript CLIs are not global CLI commands but rather, per-project dependencies.
6066

61-
for instance, vite won't be installed globally and instead it'd be always installed on a project. here's an example usage:
67+
For instance, Vite won't be installed globally and instead it'd be always installed on a project. Here's an example usage:
6268

6369
```bash
64-
pnpm vite -h
70+
pnpm vite dev
6571
```
6672

67-
so in this case, a computer might have hundreds of vite instances each installed separately and potentially from different versions on different projects.
73+
Rather than installing it globally. This example is pretty rare:
6874

69-
we were looking for a fluid strategy that would be able to load the autocompletions from each of these dependencies on a per-project basis.
75+
```bash
76+
vite dev
77+
```
78+
79+
So in this case, a computer might have hundreds of Vite instances each installed separately and potentially from different versions on different projects.
7080

71-
and that made us develop our own autocompletion abstraction over npm, pnpm and yarn. this would help tab identify which binaries are avaialble in a project and which of these binaries provide autocompletions. so the user would not have to `source` anything or inject any script in their `.zshrc`.
81+
We were looking for a fluid strategy that would be able to load the autocompletions from each of these dependencies on a per-project basis.
7282

73-
they'd only have to run this command once and inject it in their shell config.
83+
And that made us develop our own autocompletion abstraction over npm, pnpm and yarn. This would help tab identify which binaries are available in a project and which of these binaries provide autocompletions. So the user would not have to `source` anything or inject any script in their `.zshrc`.
84+
85+
They'd only have to run this command once and inject it in their shell config.
7486

7587
```bash
76-
echo 'eval "$(npx --prefer-offline @bombsh/tab pnpm zsh)"' >> ~/.zshrc
88+
npx @bombsh/tab pnpm zsh
7789
```
7890

79-
---
91+
These autocompletions on top of the normal autocompletions that these package managers provide are going to be way more powerful.
8092

81-
```typescript
82-
import t from '@bombsh/tab'
83-
84-
t.option('help', 'list available commands') // Command (Root)
93+
These new autocompletions on top of package managers would help us with autocompletions on commands like `pnpm vite` and other global or per-project binaries. The only requirement would be that the npm binary itself would be a tab-compatible binary.
8594

86-
t.command('start', 'start the development server') // Command ('start')
87-
.option('port', 'specify the port number') // Command ('port')
95+
What is a tab-compatible binary? It's a tool that provides the `complete` subcommand that was showcased above. Basically any CLI tool that uses tab for its autocompletions is a tab-compatible binary.
8896

89-
t.parse(process.argv.slice(3))
97+
```bash
98+
pnpm my-cli complete --
99+
```
100+
```
101+
start start the development server
102+
:0
103+
```
90104

91-
t.setup(process.argv[2], x)
92-
```
105+
We are planning to maintain these package manager autocompletions on our own and turn them into full-fledged autocompletions that touch on every part of our package managers.

0 commit comments

Comments
 (0)