run method

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

Runs this command.

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

Implementation

@override
Future<void> run() async {
  if (argResults == null) {
    print('${ColorsText.yellow}Usage: flyer watch [options]${ColorsText.reset}');
    print(argParser.usage);
    return;
  }

  bool watchLoc = argResults!['loc'] ?? false;
  bool verbose = argResults!['verbose'] ?? false;
  int debounceSeconds = int.tryParse(argResults!['debounce']) ?? 2;

  if (!watchLoc) {
    print('${ColorsText.yellow}No watch option specified${ColorsText.reset}');
    print('${ColorsText.blue}Usage: flyer watch --loc [--verbose]${ColorsText.reset}\n');
    print(argParser.usage);
    return;
  }

  await watchLocalization(
    debounceSeconds: debounceSeconds,
    verbose: verbose,
  );
}