(args: Argv<T>)
| 13 | * environment variable noting dry run mode. |
| 14 | */ |
| 15 | export function addDryRunFlag<T>(args: Argv<T>) { |
| 16 | return args.option('dry-run' as 'dryRun', { |
| 17 | type: 'boolean', |
| 18 | default: false, |
| 19 | description: 'Whether to do a dry run', |
| 20 | coerce: (dryRun: boolean) => { |
| 21 | if (dryRun) { |
| 22 | process.env['DRY_RUN'] = '1'; |
| 23 | } |
| 24 | return dryRun; |
| 25 | }, |
| 26 | }); |
| 27 | } |
| 28 | |
| 29 | /** Whether the current environment is in dry run mode. */ |
| 30 | export function isDryRun(): boolean { |