execute function

void execute(
  1. List<String> args
)

A common entry point to parse command line arguments and execute the process

Returns the exit code that should be set when the calling process exits. 0 implies success.

Implementation

void execute(List<String> args) {
  ArgParser argParser = ArgParser();
  argParser.addMultiOption('processors',
      abbr: 'p', allowed: Processor.defaultInstructionSet, splitCommas: true);
  ArgResults results = argParser.parse(args);
  List<String> argProcessors = results['processors'];

  Parser parser = const Parser(
    pubspecPath: 'pubspec.yaml',
    flavorizrPath: 'flavorizr.yaml',
  );

  Flavorizr? flavorizr;
  try {
    flavorizr = parser.parse();
  } catch (e) {
    stderr.writeln(e);
    exit(65);
  }

  if (argProcessors.isNotEmpty) {
    flavorizr.instructions = argProcessors;
  }

  Processor processor = Processor(flavorizr);
  processor.execute();
}