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 {
  if (argResults != null) {
    if (argResults!.wasParsed('credentials')) {
      setCredentials(path: argResults!['credentials']);
    }
  }
  if (!config.isValidCredentials()) {
    error('''Invalid path to Google Sheet credentials:

Usage:
fts init --credentials path/to/credentials

${white("How to get your credentials?", bold: true)}
https://github.com/roipeker/flutter_translation_sheet/wiki/Google-credentials
''');
    exit(2);
  }
  await exec();
  return 0;
}