MCPcopy Create free account
hub / github.com/ProtonDriveApps/sdk / validateCommandArguments

Function validateCommandArguments

cli/src/cli/registryCore.ts:91–117  ·  view source on GitHub ↗
(command: Command, args: string[], values: { [name: string]: unknown })

Source from the content-addressed store, hash-verified

89 printCommandUsage(command);
90 throw new InvalidCommandArgumentsError(`Expected ${command.args.length} arguments, got ${args.length}`);
91 }
92 }
93
94 Object.entries((command.options as ParseArgsConfig['options']) || {}).forEach(([key, option]) => {
95 if (option.default !== undefined) {
96 values[key] = values[key] || option.default;
97 return;
98 }
99 if (values[key] === undefined) {
100 printCommandUsage(command);
101 throw new InvalidCommandArgumentsError(`Missing required option: ${key}`);
102 }
103 });
104}

Callers 1

getCommandArgumentsFunction · 0.85

Calls 1

printCommandUsageFunction · 0.90

Tested by

no test coverage detected