promptCommandConfirmation method

void promptCommandConfirmation(
  1. CommandConfigBase config
)

Prompts user to confirm the generated command is correct

Implementation

void promptCommandConfirmation(CommandConfigBase config) {
  line();
  line();
  // void l(x) => line(message: '\b$x'.lightGray, prefix: '');
  final commandLineList = config.toCommandLineList();
  for (final l in commandLineList) {
    writeln('\t${l.strip().cLightBlue.italic()}'.prefixLine());
  }

  line();
  line();

  final yes = 'Yes, Continue';
  final no = 'No, Cancel';

  final result = selectOne(
    'Verify command. Is this correct?',
    choices: [yes, no],
    defaultValue: yes,
  );

  if (result == no) {
    throw CommandCancelledByUserException();
  }
}