formatUpdate static method

String formatUpdate(
  1. String current,
  2. String latest
)

formats the update message with color and with current and latest versions

Implementation

static String formatUpdate(String current, String latest) {
  var update = BrickOvenRunnerX.update;

  update = update.replaceAll('CURRENT_VERSION', current);
  update = update.replaceAll('NEW_VERSION', latest);

  update = update.replaceAll(
    'Update available!',
    cyan.wrap('Update available!')!,
  );

  update = update.replaceAll(
    'brick_oven update',
    green.wrap('brick_oven update')!,
  );
  update = update.replaceAll(
    '$current → $latest',
    darkGray.wrap('$current → $latest')!,
  );

  update = update.replaceAllMapped(
    RegExp(r'(https:\/\/.*)'),
    (match) => yellow.wrap(match[1])!,
  );

  return update;
}