fixSvgFromArguments function
Implementation
Future<void> fixSvgFromArguments(List<String> arguments) async {
final ArgParser parser = ArgParser(allowTrailingOptions: true);
parser.addFlag(helpCmd, abbr: 'h', help: 'Usage help', negatable: false);
// Make default null to differentiate when it is explicitly set
parser.addOption(
directoryCmd,
abbr: 'd',
help:
'Change all svg under specified directory and all sub directorys. (default: assets)',
defaultsTo: '',
);
final ArgResults argResults = parser.parse(arguments);
// ignore: avoid_print
print(argResults[helpCmd]);
if (argResults[helpCmd] == true) {
stdout.writeln('Fix <defs> on svg for flutter_svg');
stdout.writeln(parser.usage);
exit(0);
}
if (argResults[directoryCmd] != '') {
// ignore: avoid_print
print('process on ${argResults[directoryCmd]}...');
await processSvgsUnderDir(argResults[directoryCmd]);
exit(0);
} else {
// ignore: avoid_print
print('process on assets...');
await processSvgsUnderDir('assets');
exit(0);
}
}