@kaynooo/cli-gloss 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +25 -2
- package/dist/gloss.js +1437 -0
- package/package.json +38 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kaynooo <contact@kaynooo.fr>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kaynooo/cli-gloss
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`gloss` explains a shell command line in the terminal, the way explainshell does in a browser: each option is matched to what the man page on this machine says about it. It reads no network and runs nothing of what it explains.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
bun add -g @kaynooo/cli-gloss
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
| Command | What it does |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `gloss 'tar -xzvf a.tgz -C /tmp'` | the command, then one row per option with its description, and the value each option takes |
|
|
12
|
+
| `gloss -- git commit -am fix` | the words after `--` are the command line, so no quoting is needed |
|
|
13
|
+
| `echo 'ls -la \| wc -l' \| gloss` | without arguments the command line is read from stdin |
|
|
14
|
+
| `gloss --run-help 'rg -i foo'` | for a command with no man page, runs `rg --help` and reads its options. It runs the command, so only for ones you trust: a bare name found on `PATH`, no stdin, 3 seconds |
|
|
15
|
+
| `gloss --json 'grep -in foo file'` | `{line, commands: [{name, page, summary, notes, redirects, substitutions, next}]}` |
|
|
16
|
+
|
|
17
|
+
Pipes, `&&`, `||`, `;` and `&` split the line into commands and say what joins them. Redirects (`> out`, `2>&1`), leading variable assignments and `$(...)` substitutions are explained too, a substitution as a block of its own under the word that holds it.
|
|
18
|
+
|
|
19
|
+
## How a word is matched
|
|
20
|
+
|
|
21
|
+
- The page comes from the man path (`MANPATH`, `/usr/share/man`, `/usr/local/share/man`, `~/.local/share/man`), sections 1, 8 and 6, and is rendered with `nroff`. `git commit` reads `git-commit`.
|
|
22
|
+
- Option entries are the indented `-x, --long=ARG` lines of the page with the text under them.
|
|
23
|
+
- `-xzvf` is read as bundled flags, `-fFILE` and `--file=FILE` as an option with its value, a value-taking option without one takes the next word, a unique prefix of a long option is accepted, and `--` ends the options. A single-dash long option such as `find -name` is tried whole before it is split.
|
|
24
|
+
- A flag the page does not list is marked as not in the man page; a command with no page is listed with its words unexplained.
|
|
25
|
+
|
|
26
|
+
Pages compressed with bz2 or xz are skipped, and old-style options without a dash (`tar xvf`) are read as arguments.
|