execute method
Executes the command with the provided arguments.
Returns an integer exit code (0 for success).
Implementation
@override
Future<int> execute(List<String> arguments) async {
final ArgResults results;
try {
results = _argParser.parse(arguments);
} on FormatException catch (e) {
throw ValidationException(
'Error: ${e.message}\n\nUsage:\n flutter_setup notify status\n flutter_setup notify test [--dry-run]',
);
}
final dryRun = results['dry-run'] as bool? ?? false;
final action = results.rest.isNotEmpty ? results.rest.first : 'status';
if (action == 'status') {
return _handleStatus();
} else if (action == 'test') {
return _handleTest(dryRun: dryRun);
} else {
_output
.error('Unknown action: "$action". Supported actions: status, test');
return 1;
}
}