(keys: string[], additionalResolvedArguments: any)
| 8 | import { wrapInColor } from './logUtils'; |
| 9 | |
| 10 | function 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 | |
| 30 | export function logReproduceThisCommandIfNeeded<T>(argumentsResolver: ArgumentsResolver<T>) { |
| 31 | const keys = Object.keys(argumentsResolver.additionalResolvedArguments); |
no test coverage detected