fallback

tcmts.cli.help.fallback · #ahayldkw · term · runs anywhere

What a parameter is when it's left out: undefined if it's required.

import type { ParamShape } from "#codebase/tcmts/cli/help";

export function fallback(p: ParamShape): { value: unknown } | undefined {
  const r = p.schema["~standard"].validate(undefined) as { value?: unknown; issues?: unknown };
  return r && !("issues" in r && r.issues) ? { value: r.value } : undefined;
}

uses

used by