@kaynooo/cli-wait 0.12.6 → 0.12.7
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/cli.js +12 -6
- package/dist/slot-cli.js +12 -6
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -508,7 +508,7 @@ var init_format = __esm(() => {
|
|
|
508
508
|
|
|
509
509
|
// ../kit/src/help.ts
|
|
510
510
|
import process8 from "process";
|
|
511
|
-
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
511
|
+
function usageLine(usage, colors = paint(process8.stdout), { summary: withSummary = true } = {}) {
|
|
512
512
|
const lines = usage.replace(USAGE_PREFIX, "").split(`
|
|
513
513
|
`);
|
|
514
514
|
const blank = lines.indexOf("");
|
|
@@ -521,7 +521,7 @@ function usageLine(usage, colors = paint(process8.stdout)) {
|
|
|
521
521
|
synopses[0] = synopses[0].slice(0, colon);
|
|
522
522
|
const head = `${colors.bold("Usage:")} ${synopses.map((line) => line.replaceAll(OPTIONAL, (part) => colors.dim(part))).join(`
|
|
523
523
|
`)}`;
|
|
524
|
-
const lead = summary === undefined ? [] : ["", colors.bold(prose(summary, colors))];
|
|
524
|
+
const lead = summary === undefined || !withSummary ? [] : ["", colors.bold(prose(summary, colors))];
|
|
525
525
|
const rest = details.length === 0 ? [] : ["", ...details.map((line) => prose(line, colors))];
|
|
526
526
|
return [head, ...lead, ...rest].join(`
|
|
527
527
|
`);
|
|
@@ -531,8 +531,10 @@ function prose(line, colors) {
|
|
|
531
531
|
return line;
|
|
532
532
|
return line.replaceAll(PROSE_MARKS, (match, code, flag) => code === undefined ? colors.cyan(flag ?? match) : colors.bold(code));
|
|
533
533
|
}
|
|
534
|
-
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
|
|
535
|
-
|
|
534
|
+
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [], bin } = {}) {
|
|
535
|
+
const { summary } = description(usage);
|
|
536
|
+
const head = bin === undefined ? [usageLine(usage, colors)] : [`${colors.bold(bin.name)} ${colors.dim(bin.version())}${summary === "" ? "" : ` ${summary}`}`, "", usageLine(usage, colors, { summary: false })];
|
|
537
|
+
return [...head, "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
536
538
|
`);
|
|
537
539
|
}
|
|
538
540
|
function exitRows(exits, colors = paint(process8.stdout)) {
|
|
@@ -707,7 +709,7 @@ function parse(args, usage, options, settings = {}) {
|
|
|
707
709
|
const values = parsed.values;
|
|
708
710
|
applyOutput("color" in output ? values.color : undefined, "plain" in output ? values.plain : undefined);
|
|
709
711
|
if (values.help === true) {
|
|
710
|
-
console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings, listing)) : helpText(usage, listing, undefined, settings));
|
|
712
|
+
console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings, listing)) : helpText(usage, listing, undefined, { ...settings, bin: heading.bin }));
|
|
711
713
|
throw new HelpShown;
|
|
712
714
|
}
|
|
713
715
|
checkChoices(parsed.values, all);
|
|
@@ -844,7 +846,7 @@ function nearestOption(message, options, allowNegative) {
|
|
|
844
846
|
const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
|
|
845
847
|
return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
|
|
846
848
|
}
|
|
847
|
-
var DASHES, EXIT, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
849
|
+
var DASHES, EXIT, Exit, UsageError, HelpShown, completion, heading, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
848
850
|
var init_args = __esm(() => {
|
|
849
851
|
init_format();
|
|
850
852
|
init_help();
|
|
@@ -879,6 +881,7 @@ var init_args = __esm(() => {
|
|
|
879
881
|
}
|
|
880
882
|
};
|
|
881
883
|
completion = { active: false };
|
|
884
|
+
heading = { bin: undefined };
|
|
882
885
|
OUTPUT_OPTIONS = {
|
|
883
886
|
color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
|
|
884
887
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
@@ -1605,10 +1608,13 @@ async function runMain({ name, version, run, redact, usage }, argv = scriptArgs(
|
|
|
1605
1608
|
}
|
|
1606
1609
|
let code;
|
|
1607
1610
|
const started = performance.now();
|
|
1611
|
+
heading.bin = { name, version: () => version ?? packageVersion() };
|
|
1608
1612
|
try {
|
|
1609
1613
|
code = await run(argv);
|
|
1610
1614
|
} catch (error) {
|
|
1611
1615
|
code = reportThrown(name, error, redact, wantsJson(argv));
|
|
1616
|
+
} finally {
|
|
1617
|
+
heading.bin = undefined;
|
|
1612
1618
|
}
|
|
1613
1619
|
notifyEnd(name, code, performance.now() - started);
|
|
1614
1620
|
if (usage !== false) {
|
package/dist/slot-cli.js
CHANGED
|
@@ -508,7 +508,7 @@ var init_format = __esm(() => {
|
|
|
508
508
|
|
|
509
509
|
// ../kit/src/help.ts
|
|
510
510
|
import process8 from "process";
|
|
511
|
-
function usageLine(usage, colors = paint(process8.stdout)) {
|
|
511
|
+
function usageLine(usage, colors = paint(process8.stdout), { summary: withSummary = true } = {}) {
|
|
512
512
|
const lines = usage.replace(USAGE_PREFIX, "").split(`
|
|
513
513
|
`);
|
|
514
514
|
const blank = lines.indexOf("");
|
|
@@ -521,7 +521,7 @@ function usageLine(usage, colors = paint(process8.stdout)) {
|
|
|
521
521
|
synopses[0] = synopses[0].slice(0, colon);
|
|
522
522
|
const head = `${colors.bold("Usage:")} ${synopses.map((line) => line.replaceAll(OPTIONAL, (part) => colors.dim(part))).join(`
|
|
523
523
|
`)}`;
|
|
524
|
-
const lead = summary === undefined ? [] : ["", colors.bold(prose(summary, colors))];
|
|
524
|
+
const lead = summary === undefined || !withSummary ? [] : ["", colors.bold(prose(summary, colors))];
|
|
525
525
|
const rest = details.length === 0 ? [] : ["", ...details.map((line) => prose(line, colors))];
|
|
526
526
|
return [head, ...lead, ...rest].join(`
|
|
527
527
|
`);
|
|
@@ -531,8 +531,10 @@ function prose(line, colors) {
|
|
|
531
531
|
return line;
|
|
532
532
|
return line.replaceAll(PROSE_MARKS, (match, code, flag) => code === undefined ? colors.cyan(flag ?? match) : colors.bold(code));
|
|
533
533
|
}
|
|
534
|
-
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [] } = {}) {
|
|
535
|
-
|
|
534
|
+
function helpText(usage, options, colors = paint(process8.stdout), { examples = [], exits = [], bin } = {}) {
|
|
535
|
+
const { summary } = description(usage);
|
|
536
|
+
const head = bin === undefined ? [usageLine(usage, colors)] : [`${colors.bold(bin.name)} ${colors.dim(bin.version())}${summary === "" ? "" : ` ${summary}`}`, "", usageLine(usage, colors, { summary: false })];
|
|
537
|
+
return [...head, "", colors.bold("Options:"), ...optionRows(options, colors), ...exitRows(exits, colors), ...exampleRows(examples, colors)].join(`
|
|
536
538
|
`);
|
|
537
539
|
}
|
|
538
540
|
function exitRows(exits, colors = paint(process8.stdout)) {
|
|
@@ -707,7 +709,7 @@ function parse(args, usage, options, settings = {}) {
|
|
|
707
709
|
const values = parsed.values;
|
|
708
710
|
applyOutput("color" in output ? values.color : undefined, "plain" in output ? values.plain : undefined);
|
|
709
711
|
if (values.help === true) {
|
|
710
|
-
console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings, listing)) : helpText(usage, listing, undefined, settings));
|
|
712
|
+
console.log(wantsHelpJson() ? JSON.stringify(description(usage, settings, listing)) : helpText(usage, listing, undefined, { ...settings, bin: heading.bin }));
|
|
711
713
|
throw new HelpShown;
|
|
712
714
|
}
|
|
713
715
|
checkChoices(parsed.values, all);
|
|
@@ -844,7 +846,7 @@ function nearestOption(message, options, allowNegative) {
|
|
|
844
846
|
const meant = closest(word, known.map((flag) => flag.replace(DASHES, "")));
|
|
845
847
|
return meant === undefined ? undefined : `did you mean ${known.find((flag) => flag.replace(DASHES, "") === meant)}?`;
|
|
846
848
|
}
|
|
847
|
-
var DASHES, EXIT, Exit, UsageError, HelpShown, completion, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
849
|
+
var DASHES, EXIT, Exit, UsageError, HelpShown, completion, heading, OUTPUT_OPTIONS, UNKNOWN_OPTION;
|
|
848
850
|
var init_args = __esm(() => {
|
|
849
851
|
init_format();
|
|
850
852
|
init_help();
|
|
@@ -879,6 +881,7 @@ var init_args = __esm(() => {
|
|
|
879
881
|
}
|
|
880
882
|
};
|
|
881
883
|
completion = { active: false };
|
|
884
|
+
heading = { bin: undefined };
|
|
882
885
|
OUTPUT_OPTIONS = {
|
|
883
886
|
color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
|
|
884
887
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
@@ -1604,10 +1607,13 @@ async function runMain({ name, version, run, redact, usage }, argv = scriptArgs(
|
|
|
1604
1607
|
}
|
|
1605
1608
|
let code;
|
|
1606
1609
|
const started = performance.now();
|
|
1610
|
+
heading.bin = { name, version: () => version ?? packageVersion() };
|
|
1607
1611
|
try {
|
|
1608
1612
|
code = await run(argv);
|
|
1609
1613
|
} catch (error) {
|
|
1610
1614
|
code = reportThrown(name, error, redact, wantsJson(argv));
|
|
1615
|
+
} finally {
|
|
1616
|
+
heading.bin = undefined;
|
|
1611
1617
|
}
|
|
1612
1618
|
notifyEnd(name, code, performance.now() - started);
|
|
1613
1619
|
if (usage !== false) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-wait",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.7",
|
|
5
5
|
"description": "waitfor and slot: waits for a log line, a listening port or a URL answering, and queues heavy commands behind machine-wide slots and named locks, for Claude Code, instead of sleep and polling loops.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"waitfor": "$npm_execpath src/cli.ts"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@kaynooo/cli-kit": "0.46.
|
|
41
|
+
"@kaynooo/cli-kit": "0.46.5"
|
|
42
42
|
}
|
|
43
43
|
}
|