main function

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

Main entry point for commands.

This function is intended to be used from the mgpcli command line tool.

Implementation

Future<void> main(List<String> args) async {
  final bool verbose = args.contains('-v') || args.contains('--verbose');

  final bool doctor = (args.isNotEmpty && args.first == 'doctor') ||
      (args.length == 2 && verbose && args.last == 'doctor');
  final bool help = args.contains('-h') ||
      args.contains('--help') ||
      (args.isNotEmpty && args.first == 'help') ||
      (args.length == 1 && verbose);
  final bool muteCommandLogging = help || doctor;
  final bool verboseHelp = help && verbose;

  await runner.run(
      args,
      <MpcliCommand>[
        // AnalyzeCommand(verboseHelp: verboseHelp),
        CleanCommand(),
        CreateCommand(),
        DevicesCommand(),
        DoctorCommand(verbose: verbose),
        VersionCommand(),
        StartCommand(),
        ServiceCommand(),
      ],
      verbose: verbose,
      muteCommandLogging: muteCommandLogging,
      verboseHelp: verboseHelp,
      overrides: <Type, Generator>{
        // The build runner instance is not supported in google3 because
        // the build runner packages are not synced internally.
      });
}