MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / applyValueOrPositionalOption

Function applyValueOrPositionalOption

scripts/cli-options.ts:70–88  ·  view source on GitHub ↗
(
  args: string[],
  index: number,
  parsed: Parsed,
  config: ParserConfig<Parsed, ValueKey, BooleanKey>,
  arg: string,
)

Source from the content-addressed store, hash-verified

68}
69
70function applyValueOrPositionalOption<
71 Parsed extends object,
72 ValueKey extends keyof Parsed & string,
73 BooleanKey extends keyof Parsed & string,
74>(
75 args: string[],
76 index: number,
77 parsed: Parsed,
78 config: ParserConfig<Parsed, ValueKey, BooleanKey>,
79 arg: string,
80) {
81 const option = config.valueOptions.get(arg);
82 if (!option) {
83 return config.parsePositional(arg, index);
84 }
85
86 parsed[option] = readNextArg(args, index, arg, config.fail) as Parsed[ValueKey];
87 return index + 1;
88}
89
90export function parseVersionOptionArgument<
91 Parsed extends { version?: string },

Callers 1

parseMappedArgumentFunction · 0.85

Calls 2

readNextArgFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected