main function
Implementation
void main(List<String> args) async {
if (args.isNotEmpty) {
var parser = ArgsParser();
var parsedArgs = parser.parse(args);
var className = "Assets";
var fileName = "assets";
var extensions = {};
if (parsedArgs.containsKey("n")) {
className = parsedArgs['n'];
}
if (parsedArgs.containsKey("fn")) {
fileName = parsedArgs['fn'];
}
if (parsedArgs.containsKey('ext')) {
var ext = parsedArgs['ext'].toString().split(",");
for (var element in ext) {
extensions[element] = element;
}
}
var assetsPath = Directory("${Directory.current.path}/${parsedArgs['i']}");
var classBuilder = StringBuffer();
classBuilder.writeln("abstract class $className {");
assetsPath.listSync().forEach((element) {
if (extensions.containsKey(element.path.split(".").last) ||
extensions.isEmpty) {
_writeToClass(element, classBuilder, parsedArgs['i']);
}
});
classBuilder.writeln("}");
_writeToFile(_createFile(fileName, parsedArgs['o']), classBuilder);
}
}