@flowrunner/cli 0.1.5 → 0.1.6
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 +32 -24
- package/dist/cli.js.map +3 -3
- package/dist/types/shared/src/constants/docs.d.ts +4 -0
- package/dist/types/shared/src/constants/index.d.ts +1 -0
- package/package.json +1 -1
- package/runtime/types/shared/src/constants/docs.d.ts +4 -0
- package/runtime/types/shared/src/constants/index.d.ts +1 -0
package/dist/cli.js
CHANGED
|
@@ -4185,7 +4185,7 @@ var require_package = __commonJS({
|
|
|
4185
4185
|
"package.json"(exports2, module2) {
|
|
4186
4186
|
module2.exports = {
|
|
4187
4187
|
name: "@flowrunner/cli",
|
|
4188
|
-
version: "0.1.
|
|
4188
|
+
version: "0.1.6",
|
|
4189
4189
|
publishConfig: {
|
|
4190
4190
|
access: "public"
|
|
4191
4191
|
},
|
|
@@ -4672,7 +4672,7 @@ function stripConditionals(source, answers, origin) {
|
|
|
4672
4672
|
throw new Error(`Unknown flag "${name}" in {{#if}} at ${origin}:${index + 1}`);
|
|
4673
4673
|
}
|
|
4674
4674
|
const matches = expected === void 0 ? Boolean(answers[name]) : String(answers[name]) === expected;
|
|
4675
|
-
stack.push({ name, keep: matches && stack.every((
|
|
4675
|
+
stack.push({ name, keep: matches && stack.every((frame) => frame.keep) });
|
|
4676
4676
|
continue;
|
|
4677
4677
|
}
|
|
4678
4678
|
if (IF_CLOSE.test(line)) {
|
|
@@ -4681,7 +4681,7 @@ function stripConditionals(source, answers, origin) {
|
|
|
4681
4681
|
}
|
|
4682
4682
|
continue;
|
|
4683
4683
|
}
|
|
4684
|
-
if (stack.every((
|
|
4684
|
+
if (stack.every((frame) => frame.keep)) {
|
|
4685
4685
|
output.push(line);
|
|
4686
4686
|
}
|
|
4687
4687
|
}
|
|
@@ -9933,6 +9933,7 @@ async function interactiveLogin(gap) {
|
|
|
9933
9933
|
|
|
9934
9934
|
// src/cli/prompts/select-list.ts
|
|
9935
9935
|
var import_node_readline = __toESM(require("node:readline"));
|
|
9936
|
+
var import_node_util = require("node:util");
|
|
9936
9937
|
function canRenderList() {
|
|
9937
9938
|
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
9938
9939
|
}
|
|
@@ -9973,46 +9974,52 @@ var SHOW_CURSOR = "\x1B[?25h";
|
|
|
9973
9974
|
function styling() {
|
|
9974
9975
|
return process.env.NO_COLOR ? { dim: "", bold: "", reset: "" } : { dim: "\x1B[2m", bold: "\x1B[1m", reset: "\x1B[0m" };
|
|
9975
9976
|
}
|
|
9976
|
-
function
|
|
9977
|
-
|
|
9978
|
-
return plainLength <= width ? line : `${line.slice(0, line.length - (plainLength - width) - 1)}\u2026`;
|
|
9977
|
+
function terminalColumns() {
|
|
9978
|
+
return process.stdout.columns || 80;
|
|
9979
9979
|
}
|
|
9980
|
-
function
|
|
9980
|
+
function renderFrame(choices, selected, columns) {
|
|
9981
9981
|
const { dim, bold, reset } = styling();
|
|
9982
|
-
const
|
|
9982
|
+
const rows = [];
|
|
9983
9983
|
for (const [index, choice] of choices.entries()) {
|
|
9984
9984
|
const active = index === selected;
|
|
9985
|
-
|
|
9986
|
-
const label = active ? `${bold}${choice.label}${reset}` : choice.label;
|
|
9987
|
-
lines.push(fit(`${pointer} ${label}`, `${pointer} ${choice.label}`.length));
|
|
9985
|
+
rows.push({ prefix: active ? "\u276F " : " ", text: choice.label, style: active ? bold : "" });
|
|
9988
9986
|
if (choice.description) {
|
|
9989
|
-
|
|
9987
|
+
rows.push({ prefix: " ", text: choice.description, style: dim });
|
|
9990
9988
|
}
|
|
9991
9989
|
}
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9995
|
-
|
|
9996
|
-
|
|
9997
|
-
|
|
9990
|
+
rows.push({ prefix: "", text: "", style: "" });
|
|
9991
|
+
rows.push({ prefix: " ", text: "\u2191/\u2193 to move \xB7 enter to select \xB7 esc to cancel", style: dim });
|
|
9992
|
+
const width = columns - 1;
|
|
9993
|
+
return rows.map(({ prefix, text: text2, style }) => {
|
|
9994
|
+
const room = width - prefix.length;
|
|
9995
|
+
const fitted = text2.length <= room ? text2 : `${text2.slice(0, Math.max(room - 1, 0))}\u2026`;
|
|
9996
|
+
return style && fitted ? `${prefix}${style}${fitted}${reset}` : `${prefix}${fitted}`;
|
|
9997
|
+
});
|
|
9998
|
+
}
|
|
9999
|
+
function rowsOccupied(lines, columns) {
|
|
10000
|
+
return lines.reduce((total, line) => {
|
|
10001
|
+
const visible = (0, import_node_util.stripVTControlCharacters)(line).length;
|
|
10002
|
+
return total + Math.max(1, Math.ceil(visible / columns));
|
|
10003
|
+
}, 0);
|
|
9998
10004
|
}
|
|
9999
10005
|
function selectFromList(title, choices, startAt = 0) {
|
|
10000
10006
|
const { stdin, stdout } = process;
|
|
10001
10007
|
return new Promise((resolve, reject) => {
|
|
10002
10008
|
let selected = Math.min(Math.max(startAt, 0), choices.length - 1);
|
|
10003
|
-
let painted =
|
|
10009
|
+
let painted = [];
|
|
10004
10010
|
const draw = () => {
|
|
10005
|
-
|
|
10006
|
-
|
|
10011
|
+
const columns = terminalColumns();
|
|
10012
|
+
if (painted.length > 0) {
|
|
10013
|
+
import_node_readline.default.moveCursor(stdout, 0, -rowsOccupied(painted, columns));
|
|
10007
10014
|
import_node_readline.default.clearScreenDown(stdout);
|
|
10008
10015
|
}
|
|
10009
|
-
|
|
10010
|
-
stdout.write(`${
|
|
10016
|
+
painted = renderFrame(choices, selected, columns);
|
|
10017
|
+
stdout.write(`${painted.join("\n")}
|
|
10011
10018
|
`);
|
|
10012
|
-
painted = lines.length;
|
|
10013
10019
|
};
|
|
10014
10020
|
const cleanup = () => {
|
|
10015
10021
|
stdin.off("keypress", onKeypress);
|
|
10022
|
+
stdout.off("resize", draw);
|
|
10016
10023
|
if (stdin.isTTY) {
|
|
10017
10024
|
stdin.setRawMode(false);
|
|
10018
10025
|
}
|
|
@@ -10044,6 +10051,7 @@ ${title}
|
|
|
10044
10051
|
stdin.setRawMode(true);
|
|
10045
10052
|
stdin.resume();
|
|
10046
10053
|
stdin.on("keypress", onKeypress);
|
|
10054
|
+
stdout.on("resize", draw);
|
|
10047
10055
|
draw();
|
|
10048
10056
|
});
|
|
10049
10057
|
}
|