run method

  1. @override
Future<ExitCode> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<ExitCode> run() async {
  final content = scriptsYaml.scripts();
  if (content == null) {
    logger.err('No ${ScriptsYaml.fileName} file found');
    return ExitCode.noInput;
  }

  final scriptConfig = ScriptsConfig.fromJson(content);

  logger
    ..write('\n')
    ..info(
      scriptConfig.listOut(
        wrapCallableKey: (s) => lightGreen.wrap(s) ?? s,
        wrapNonCallableKey: (s) => cyan.wrap(s) ?? s,
        wrapMeta: (s) => lightBlue.wrap(s) ?? s,
      ),
    );

  return ExitCode.success;
}