run method

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

Runs this command.

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

Implementation

@override
Future<int> run() async {
  try {
    if (!await validateProjectDirectory()) {
      return ExitCode.usage.code;
    }

    if (!await validateApiKey()) {
      return ExitCode.config.code;
    }

    return await execute();
  } catch (e, stackTrace) {
    logger.err('Command failed: $e');
    if (verbose) {
      logger.detail('Stack trace: $stackTrace');
    }
    return ExitCode.software.code;
  }
}