@kaynooo/cli-gloss 0.0.1 → 0.0.2
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/dist/gloss.js +6 -5
- package/package.json +2 -2
package/dist/gloss.js
CHANGED
|
@@ -949,12 +949,13 @@ function parseOptions(text) {
|
|
|
949
949
|
close();
|
|
950
950
|
continue;
|
|
951
951
|
}
|
|
952
|
-
if (trimmed.startsWith("-")
|
|
952
|
+
if (trimmed.startsWith("-")) {
|
|
953
953
|
const [head = "", ...rest] = trimmed.split(HEAD_SPLIT);
|
|
954
954
|
const parsed = parseHead(head);
|
|
955
|
-
|
|
955
|
+
const starts = current === undefined || indent <= current.indent || current.inline && rest.length > 0;
|
|
956
|
+
if (parsed !== undefined && starts) {
|
|
956
957
|
close();
|
|
957
|
-
current = { doc: { ...parsed, text: "" }, indent, lines: rest };
|
|
958
|
+
current = { doc: { ...parsed, text: "" }, indent, inline: rest.length > 0, lines: rest };
|
|
958
959
|
continue;
|
|
959
960
|
}
|
|
960
961
|
}
|
|
@@ -1366,7 +1367,7 @@ function rows(entries, stream, depth) {
|
|
|
1366
1367
|
return out;
|
|
1367
1368
|
}
|
|
1368
1369
|
function painter(kind, stream) {
|
|
1369
|
-
const roles = { option: "
|
|
1370
|
+
const roles = { option: "id", value: "value", argument: "path", unknown: "warn" };
|
|
1370
1371
|
return role(roles[kind], stream);
|
|
1371
1372
|
}
|
|
1372
1373
|
function noteText(note) {
|
|
@@ -1384,7 +1385,7 @@ function block(gloss, stream, depth) {
|
|
|
1384
1385
|
const origin = gloss.source === "help" ? " (from --help)" : "";
|
|
1385
1386
|
out.push(`${margin}${role("accent", stream)(colors.bold(gloss.name))}${summary === undefined ? "" : colors.dim(` ${summary}`)}${colors.dim(origin)}`);
|
|
1386
1387
|
const entries = [
|
|
1387
|
-
...gloss.assigns.map((assign) => ({ token: assign, paintToken: role("
|
|
1388
|
+
...gloss.assigns.map((assign) => ({ token: assign, paintToken: role("value", stream), text: "sets this variable for the command only" })),
|
|
1388
1389
|
...gloss.notes.map((note) => ({ token: note.token, paintToken: painter(note.kind, stream), text: noteText(note) })),
|
|
1389
1390
|
...gloss.redirects.map((redirect) => ({ ...redirect, paintToken: role("path", stream) }))
|
|
1390
1391
|
];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-gloss",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.2",
|
|
5
5
|
"description": "gloss: explains a shell command line, each word matched to what its man page says.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,6 +35,6 @@
|
|
|
35
35
|
"gloss": "$npm_execpath src/gloss.ts"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@kaynooo/cli-kit": "0.38.
|
|
38
|
+
"@kaynooo/cli-kit": "0.38.3"
|
|
39
39
|
}
|
|
40
40
|
}
|