execute method
execute command
Implementation
@override
Future<void> execute() async {
var isProject = false;
if (RgbCli.arguments[0] == 'create' || RgbCli.arguments[0] == '-c') {
isProject = RgbCli.arguments[1].split(':').first == 'project';
}
var fullName = name;
if (fullName.isEmpty || isProject) {
fullName = 'home';
}
// Extract module name from `-m` flag
var moduleName = 'general'; // Default module for routing
var wrapWithModuleFolder = false; // Default: create directly under lib/presentation
for (var i = 0; i < RgbCli.arguments.length; i++) {
if (RgbCli.arguments[i] == '-m' && i + 1 < RgbCli.arguments.length) {
moduleName = RgbCli.arguments[i + 1]; // Assign module name
wrapWithModuleFolder = true; // When -m is provided, wrap with module folder
break;
}
}
checkForAlreadyExists(moduleName, wrapWithModuleFolder, fullName);
}