MCPcopy Create free account
hub / github.com/Snapchat/Valdi / logReproduceWith

Function logReproduceWith

npm_modules/cli/src/utils/errorUtils.ts:10–28  ·  view source on GitHub ↗
(keys: string[], additionalResolvedArguments: any)

Source from the content-addressed store, hash-verified

8import { wrapInColor } from './logUtils';
9
10function logReproduceWith(keys: string[], additionalResolvedArguments: any) {
11 const allArguments = ['valdi', ...process.argv.slice(2)];
12 keys.sort();
13
14 for (const key of keys.sort()) {
15 const value = additionalResolvedArguments[key];
16 if (Array.isArray(value)) {
17 for (const item of value) {
18 allArguments.push(`--${key}`, item.toString());
19 }
20 } else {
21 allArguments.push(`--${key}`, value.toString());
22 }
23 }
24
25 console.log(
26 `\n${wrapInColor('Note: Use the following command next time to reproduce without prompts', ANSI_COLORS.GREEN_COLOR)}\n${allArguments.join(' ')}\n`,
27 );
28}
29
30export function logReproduceThisCommandIfNeeded<T>(argumentsResolver: ArgumentsResolver<T>) {
31 const keys = Object.keys(argumentsResolver.additionalResolvedArguments);

Callers 1

Calls 7

wrapInColorFunction · 0.90
sortMethod · 0.65
toStringMethod · 0.65
logMethod · 0.65
isArrayMethod · 0.45
pushMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected