mainWithExitCode function

Future<int> mainWithExitCode(
  1. List<String> args
)

Implementation

Future<int> mainWithExitCode(List<String> args) async {
  var runner = CommandRunner('git', 'Distributed version control.')
    ..addCommand(InitCommand())
    ..addCommand(AddCommand())
    ..addCommand(BranchCommand())
    ..addCommand(CatFileCommand())
    ..addCommand(CheckoutCommand())
    ..addCommand(DumpIndexCommand())
    ..addCommand(HashObjectCommand())
    ..addCommand(LogCommand())
    ..addCommand(RemoteCommand())
    ..addCommand(StatusCommand())
    ..addCommand(RmCommand())
    ..addCommand(WriteTreeCommand())
    ..addCommand(MergeBaseCommand())
    ..addCommand(DiffTreeCommand())
    ..addCommand(DiffCommand())
    ..addCommand(LsTreeCommand());

  try {
    await runner.run(args);
  } on GitException catch (e) {
    print(e);
    return 1;
  } catch (e, stacktrace) {
    print(e);
    print(stacktrace);
    return 1;
  }

  return 0;
}