run method
Implementation
Future<void> run(List<String> arguments) async {
if (arguments.isEmpty) {
printUsage();
return;
}
final featureName = arguments[0];
if (featureName == 'list') {
await _listFeatures();
return;
}
if (arguments.length > 1) {
if (arguments.contains('-sm')) {
final architecture = await _getCurrentArchitecture(featureName);
if (architecture != null) {
await _handleOption(arguments, featureName);
return;
}
}
if (_featureExists(featureName)) {
await _handleOption(arguments, featureName);
return;
}
}
if (_featureExists(featureName) && arguments.length == 1) {
Logger.error('Feature "$featureName" already exists.');
return;
}
if (arguments.length > 1 && ['-mvc', '-mvvm', '-clean'].contains(arguments[1])) {
final architecture = arguments[1].substring(1);
final stateManagement = await _promptForStateManagement();
final customClassName = stateManagement != null ? _promptForCustomClassName() : null;
await GetItManager.manageGetIt(featureName, stateManagement, architecture);
_createFeatureStructure(featureName, stateManagement, customClassName, architecture);
Logger.success('Feature "$featureName" created successfully with $architecture architecture');
return;
}
await _createFeatureWithPrompt(featureName);
}