@hardfin/cli 0.1.1-dev.80 → 0.1.1-dev.81

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="50f0c82d-608e-5ae9-93f0-b139f5ec4a64")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a537bf8d-66c3-548b-80b1-e7f36232e39c")}catch(e){}}();
4
4
  import module from "node:module";
5
5
  //#region src/cli.ts
6
6
  module.enableCompileCache?.();
@@ -14,7 +14,7 @@ process.on("unhandledRejection", (error) => void toCrash(error));
14
14
  try {
15
15
  const answer = await toQuickAnswer(process.argv.slice(2));
16
16
  if (answer === void 0) {
17
- const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-zwSIyT_B.js");
17
+ const { toCli, toParseExitCode, wasReportAttempted } = await import("./program-DmXptEFH.js");
18
18
  const { startUpdateCheck, writeUpdateNotice } = await import("./notice-NFwdPDiu.js");
19
19
  const pending = startUpdateCheck(process.argv.slice(2));
20
20
  try {
@@ -36,7 +36,7 @@ async function toCrash(error) {
36
36
  isCrashing = true;
37
37
  const isJSON = process.argv.includes("--json") || !process.stdout.isTTY;
38
38
  try {
39
- const { toReported, writeCrash } = await import("./program-zwSIyT_B.js");
39
+ const { toReported, writeCrash } = await import("./program-DmXptEFH.js");
40
40
  writeCrash(error, isJSON);
41
41
  await toReported(error, isJSON, void 0, "fatal");
42
42
  } catch {
@@ -57,4 +57,4 @@ async function toQuickAnswer(args) {
57
57
  export {};
58
58
 
59
59
  //# sourceMappingURL=cli.js.map
60
- //# debugId=50f0c82d-608e-5ae9-93f0-b139f5ec4a64
60
+ //# debugId=a537bf8d-66c3-548b-80b1-e7f36232e39c
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="39f8eb53-02af-5f8d-9352-7d075b3b444c")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7eb3383a-f8be-5d32-9b8c-64f377cae41f")}catch(e){}}();
4
4
  import { a as defineCommand, i as GLOBAL_FLAGS, r as ExitCode, t as toInvocation } from "./scrub-BZ0egWxC.js";
5
5
  import { C as Interrupted, S as ExpectedFailure, T as TimedOut, _ as ConfigFailure, a as isShipped, b as toTelemetry, g as CONFIG_FILE, h as writeFailure, i as toUpdateCheckRefusal, l as toStateDirectory, m as writeData, o as toPackageDirectory, p as toText, r as toCheck, s as noteNotices, t as PACKAGE, u as isJSONOutput, v as toSettings, w as LockHeld, x as version$1, y as API_VERSION } from "./check-BchCSL3T.js";
6
6
  import { n as toAnswer$1, r as toCompletion, t as PATH_VALUES } from "./completion-tree-DLC6ARLR.js";
@@ -15208,9 +15208,29 @@ function toRejectedFlag(command, flags) {
15208
15208
  if (value === void 0) continue;
15209
15209
  const given = toNullOrText(value, flag.nullable === true);
15210
15210
  if (given === null) continue;
15211
- if (!flag.schema.safeParse(given).success) return `--${flag.name} does not accept ${JSON.stringify(value)}`;
15211
+ if (!flag.schema.safeParse(given).success) {
15212
+ const expected = toExpectedNumber(flag.schema);
15213
+ return `--${flag.name} does not accept ${JSON.stringify(value)}${expected ? `, and takes ${expected}` : ""}`;
15214
+ }
15212
15215
  }
15213
15216
  }
15217
+ /** toExpectedNumber describes the numbers a flag takes, or nothing when it is not a number. */
15218
+ function toExpectedNumber(schema) {
15219
+ const number = schema instanceof z.ZodPipe ? schema.out : schema;
15220
+ if (!(number instanceof z.ZodNumber)) return;
15221
+ const kind = number.format === "safeint" ? "a whole number" : "a number";
15222
+ const minimum = toStatedBound(number.minValue);
15223
+ const maximum = toStatedBound(number.maxValue);
15224
+ if (minimum !== void 0 && maximum !== void 0) return `${kind} from ${minimum} to ${maximum}`;
15225
+ if (minimum !== void 0) return `${kind} of at least ${minimum}`;
15226
+ if (maximum !== void 0) return `${kind} of at most ${maximum}`;
15227
+ return kind;
15228
+ }
15229
+ /** toStatedBound keeps a bound only when it is narrower than any number already is. */
15230
+ function toStatedBound(bound) {
15231
+ if (bound === null || !Number.isFinite(bound) || Math.abs(bound) === Number.MAX_SAFE_INTEGER) return;
15232
+ return bound;
15233
+ }
15214
15234
  //#endregion
15215
15235
  //#region src/cli/program.ts
15216
15236
  /** toCli builds the parser from the registry, which is what every surface reads. */
@@ -15295,5 +15315,5 @@ async function toReported(error, isJSON, resolved, level = "error") {
15295
15315
  //#endregion
15296
15316
  export { toCli, toParseExitCode, toReported, wasReportAttempted, writeCrash };
15297
15317
 
15298
- //# sourceMappingURL=program-zwSIyT_B.js.map
15299
- //# debugId=39f8eb53-02af-5f8d-9352-7d075b3b444c
15318
+ //# sourceMappingURL=program-DmXptEFH.js.map
15319
+ //# debugId=7eb3383a-f8be-5d32-9b8c-64f377cae41f
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardfin/cli",
3
- "version": "0.1.1-dev.80",
3
+ "version": "0.1.1-dev.81",
4
4
  "description": "Command line interface for the Hardfin API",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Hardfin, Inc.",