updateWebvifyConfigurationFromArguments function
Implementation
Future<void> updateWebvifyConfigurationFromArguments(
List<String> arguments) async {
final parser = ArgParser(allowTrailingOptions: true);
parser.addFlag(
debugFlag,
abbr: 'd',
help: 'Usage Debug',
negatable: false,
);
parser.addFlag(
helpFlag,
abbr: 'h',
help: 'Usage help',
negatable: false,
);
// Make default null to differentiate when it is explicitly set
parser.addOption(
fileOption,
abbr: 'f',
help: 'Config file (default: $DEFAULT_CONFIG_FILES)',
);
argResults = parser.parse(arguments);
if (argResults[helpFlag]) {
info('Updates Webvify Configuration for iOS and Android');
stdout.writeln(parser.usage);
exit(0);
}
try {
final config = await loadConfigFileFromArgResults(
argResults,
verbose: true,
);
await updateWebvifyConfigurationFromConfig(config);
} catch (e) {
if (e is InvalidFormatException) {
error('Invalid configuration format.');
} else {
error(e.toString());
}
exit(2);
}
}