MCPcopy Index your code
hub / github.com/cloudconvert/cloudconvert-cli / getKnownArgumentKeys

Function getKnownArgumentKeys

src/commands/task-parameters.ts:36–53  ·  view source on GitHub ↗
(yargs: Argv<T>)

Source from the content-addressed store, hash-verified

34}
35
36function getKnownArgumentKeys<T>(yargs: Argv<T>): Set<string> {
37 const { key = {}, alias = {} } = (yargs as ArgvWithParserOptions<T>).getOptions();
38 const knownArgumentKeys = new Set(['_', '$0', 'taskParameters']);
39
40 for (const optionName of Object.keys(key)) {
41 knownArgumentKeys.add(optionName);
42 knownArgumentKeys.add(toCamelCase(optionName));
43 }
44
45 for (const aliasNames of Object.values(alias)) {
46 for (const aliasName of aliasNames) {
47 knownArgumentKeys.add(aliasName);
48 knownArgumentKeys.add(toCamelCase(aliasName));
49 }
50 }
51
52 return knownArgumentKeys;
53}
54
55function toCamelCase(optionName: string): string {
56 return optionName.replace(/-([a-z])/g, (_, letter: string) => letter.toUpperCase());

Callers 1

Calls 2

toCamelCaseFunction · 0.85
getOptionsMethod · 0.80

Tested by

no test coverage detected