spur-board 0.36.0 → 0.36.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/dist/cli.mjs +2 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -2067,7 +2067,7 @@ function buildInput(op, args, options) {
|
|
|
2067
2067
|
if (options[flag] !== void 0) input[field] = options[flag];
|
|
2068
2068
|
}
|
|
2069
2069
|
const selected = op.cli.modes?.filter((mode) => options[optionField(mode.flag)] !== void 0);
|
|
2070
|
-
if (selected && selected.length !== 1) throw new CliError("usage");
|
|
2070
|
+
if (selected && selected.length !== 1) throw new CliError("usage", void 0, void 0, `Pass exactly one of ${(op.cli.modes ?? []).map((mode) => mode.flag).join(", ")}.`);
|
|
2071
2071
|
if (selected?.[0]) {
|
|
2072
2072
|
input["mode"] = selected[0].mode;
|
|
2073
2073
|
if (selected[0].value) {
|
|
@@ -2211,10 +2211,8 @@ function createProgram(options = {}) {
|
|
|
2211
2211
|
const json = Boolean(invoked.opts()["json"] || program.opts()["json"]);
|
|
2212
2212
|
const input = buildInput(op, parts.slice(0, -1), invoked.opts());
|
|
2213
2213
|
const keyOption = invoked.opts()["key"];
|
|
2214
|
-
if (keyOption !== void 0 && typeof keyOption !== "string") throw new CliError("usage");
|
|
2215
|
-
if (keyOption === "") throw new CliError("usage");
|
|
2214
|
+
if (keyOption !== void 0 && (typeof keyOption !== "string" || keyOption === "")) throw new CliError("usage", void 0, void 0, "Pass a nonempty --key, or omit it to have one generated.");
|
|
2216
2215
|
if (keyOption !== void 0 && escapeTerminalControls(keyOption) !== keyOption) throw new CliError("usage", void 0, void 0, "The idempotency key must contain only printable characters.");
|
|
2217
|
-
if (op.kind === "mutation" && env["SPUR_SESSION"] && !keyOption) throw new CliError("usage");
|
|
2218
2216
|
const config = options.clientConfig ?? loadOperationConfig(op, input, env);
|
|
2219
2217
|
const key = op.kind === "mutation" ? keyOption || randomUUID() : void 0;
|
|
2220
2218
|
if (key) io.stderr(`key: ${escapeTerminalControls(key)}\n`);
|