@kjanat/dreamcli 3.0.0-rc.12 → 3.0.0-rc.13
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/CHANGELOG.md +13 -1
- package/dist/core/help/index.mjs +31 -5
- package/dist/version.mjs +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [3.0.0-rc.13] - 2026-07-20
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Syntax-highlighted example commands** — the `Examples:` help section now
|
|
15
|
+
highlights each command per token: the leading binary via `usageBin` (bold)
|
|
16
|
+
and flag tokens (`-x`, `--long`) via `flag` (cyan), with values left plain.
|
|
17
|
+
Tokenizing is quote-aware so `--scope './a b'` stays one token, and the
|
|
18
|
+
existing color gate is respected (identity formatters when `NO_COLOR` or
|
|
19
|
+
non-TTY), so `stripAnsi(colored)` still equals the plain rendering.
|
|
20
|
+
|
|
10
21
|
## [3.0.0-rc.12] - 2026-07-20
|
|
11
22
|
|
|
12
23
|
### Added
|
|
@@ -1264,7 +1275,8 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
1264
1275
|
- MIT License.
|
|
1265
1276
|
- Markdownlint configuration.
|
|
1266
1277
|
|
|
1267
|
-
[Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.
|
|
1278
|
+
[Unreleased]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.13...HEAD
|
|
1279
|
+
[3.0.0-rc.13]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.12...v3.0.0-rc.13
|
|
1268
1280
|
[3.0.0-rc.12]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.11...v3.0.0-rc.12
|
|
1269
1281
|
[3.0.0-rc.11]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.10...v3.0.0-rc.11
|
|
1270
1282
|
[3.0.0-rc.10]: https://github.com/kjanat/dreamcli/compare/v3.0.0-rc.9...v3.0.0-rc.10
|
package/dist/core/help/index.mjs
CHANGED
|
@@ -322,19 +322,45 @@ function formatCommandsSection(commands, opts) {
|
|
|
322
322
|
return lines.join("\n");
|
|
323
323
|
}
|
|
324
324
|
/**
|
|
325
|
+
* One shell token: a single- or double-quoted span (kept whole so internal
|
|
326
|
+
* spaces don't split it) or a run of non-whitespace characters.
|
|
327
|
+
*/
|
|
328
|
+
const EXAMPLE_TOKEN = /(?:'[^']*'|"[^"]*"|\S)+/g;
|
|
329
|
+
/**
|
|
330
|
+
* Highlight an example command per token: the leading binary via `usageBin`,
|
|
331
|
+
* flag tokens (`-x`, `--long`) via `flag`, everything else plain.
|
|
332
|
+
*
|
|
333
|
+
* Uses `replace` so only the token spans are wrapped and the whitespace
|
|
334
|
+
* between them is preserved verbatim — with the color gate off (identity
|
|
335
|
+
* formatters) the result equals `command`, so `stripAnsi(highlighted)` stays
|
|
336
|
+
* equal to the plain rendering.
|
|
337
|
+
*/
|
|
338
|
+
function highlightExampleCommand(command, theme) {
|
|
339
|
+
let index = 0;
|
|
340
|
+
return command.replace(EXAMPLE_TOKEN, (token) => {
|
|
341
|
+
const styled = index === 0 ? theme.usageBin(token) : token.startsWith("-") ? theme.flag(token) : token;
|
|
342
|
+
index += 1;
|
|
343
|
+
return styled;
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
325
347
|
* Render the `Examples:` help section.
|
|
326
348
|
*
|
|
327
349
|
* @param examples - Array of {@link CommandExample} entries.
|
|
328
|
-
* @param theme - Theme applied to the section title
|
|
350
|
+
* @param theme - Theme applied to the section title, `$` prompt marker, and
|
|
351
|
+
* per-token command highlighting.
|
|
329
352
|
* @returns Multi-line examples section string.
|
|
330
353
|
*/
|
|
331
354
|
function formatExamplesSection(examples, theme) {
|
|
332
355
|
const lines = [theme.sectionTitle("Examples:")];
|
|
333
356
|
const prompt = theme.examplePrompt("$");
|
|
334
|
-
for (const example of examples)
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
357
|
+
for (const example of examples) {
|
|
358
|
+
const command = highlightExampleCommand(example.command, theme);
|
|
359
|
+
if (example.description !== void 0) {
|
|
360
|
+
lines.push(` ${example.description}:`);
|
|
361
|
+
lines.push(` ${prompt} ${command}`);
|
|
362
|
+
} else lines.push(` ${prompt} ${command}`);
|
|
363
|
+
}
|
|
338
364
|
return lines.join("\n");
|
|
339
365
|
}
|
|
340
366
|
//#endregion
|
package/dist/version.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/version.ts
|
|
2
2
|
/** Package version (e.g. `"0.9.1"`). `"dev"` when running unbundled. */
|
|
3
|
-
const DREAMCLI_VERSION = "3.0.0-rc.
|
|
3
|
+
const DREAMCLI_VERSION = "3.0.0-rc.13";
|
|
4
4
|
/** Git short SHA (e.g. `"f9b5f1a"`). `"dev"` when running unbundled. */
|
|
5
|
-
const DREAMCLI_REVISION = "
|
|
5
|
+
const DREAMCLI_REVISION = "a6777ca";
|
|
6
6
|
//#endregion
|
|
7
7
|
export { DREAMCLI_REVISION, DREAMCLI_VERSION };
|