main method

Future<void> main(
  1. List<String> arguments
)

Implementation

Future<void> main(List<String> arguments) async {
  final CommandRunner<void> runner = CommandRunner<void>(
    'subscription_cli',
    'A command-line interface for managing subscriptions.',
  );

  runner.argParser.addFlag(
    'verbose',
    abbr: 'v',
    defaultsTo: false,
    negatable: false,
    help: 'Show extra logging information.',
  );

  void addCommand(BaseCommond command) => runner.addCommand(command);

  addCommand(RunCommand());
  addCommand(AnalyzeCommand());
  addCommand(VersionCommand());
  addCommand(ExampleCommand());
  addCommand(ChooseJobCommand());

  try {
    await runner.run(arguments);
  } catch (e, st) {
    logger.log(e.toString());

    logger.debug(st.toString());

    if (e is ArgumentError) {
      exit(10);
    }

    if (e is UnimplementedError) {
      exit(11);
    }

    exit(-1);
  }
}