runCLI function
Implementation
void runCLI(List<String> arguments) {
ExitCode.success();
final ArgParser argParser = ArgParserBuilder.buildParser();
final HelpCommand helpCommand = HelpCommand(argParser: argParser);
final CreateCommand createCommand = CreateCommand();
final AnalyzeCommand analyzeCommand = AnalyzeCommand();
try {
final ArgResults results = argParser.parse(arguments);
if (results.wasParsed(ParserConstants.helpFlag)) {
helpCommand.run();
return;
}
if (results.command?.name == ParserConstants.createCommand) {
createCommand.run();
return;
}
if (results.command?.name == ParserConstants.analyzeCommand) {
analyzeCommand.run(
args: AnalyzeCommandArgs(
verbose:
results.command?.wasParsed(ParserConstants.verboseFlag) ??
false,
analyzeArb: results.command?.wasParsed(ParserConstants.arbFlag) ??
false));
return;
}
helpCommand.run();
} on FormatException catch (e) {
print(red('${e.message}\n'));
helpCommand.run();
ExitCode.error();
}
}