openWizard method

Prompt openWizard(
  1. String title,
  2. String configPath
)

Prints the wizard header and returns the prompt to drive it with.

Every wizard opens the same way — what is being created, and which file it will be written to — so the user knows what is about to change before answering the first question.

Implementation

Prompt openWizard(String title, String configPath) {
  // A wizard under --quiet or --silent would hide the questions, the menus
  // and the review block while still blocking on answers — the user would be
  // staring at a cursor with no idea what is being asked.
  if (ColorizeLogger.verbosity.rank < LogVerbosity.normal.rank) {
    throw PromptAbortedException(
      'the wizard needs to print its questions, so it cannot run under '
      '--quiet or --silent. Pass the values as options instead.',
    );
  }

  final sep = LogSymbols.separator;
  logger.logInfo(
    ColorizeLogger.dim(
      ['distribute $packageVersion', title, configPath].join('  $sep  '),
    ),
  );
  logger.logEmpty();
  return Prompt(logger);
}