run method
Implementation
Future run(List<String> arguments) async {
if (arguments.length < 1) {
print('available commands:');
availableCommands.allSubtypes.forEach((key, info) {
String help = info.annotations.containsKey('HelpText') ? info.annotations['HelpText'] : '';
print(classCodeToCommand(key) + ' ' + allCommands[key]!.params.map((e) => '[$e]').join(' ') + '\t' + help);
});
return;
}
String classCode = commandToClassCode(arguments[0]);
if (!allCommands.containsKey(classCode)) {
throw new Exception('unknown command ${arguments[0]}');
}
var command = allCommands[classCode]!;
var parser = getCommandArgParser(command);
ArgResults args = parser.parse(arguments);
await config.load(args['config'] ?? path.dirname(Platform.script.toFilePath()) + '/config.yaml');
command.setCliArgs(args);
await command.run();
await db.disconnect();
}