run method

  1. @override
void run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
void run() async {
  final String? apps = argResults?['apps-name']?.toString().snakeCase;
  final String? feature = argResults?['feature']?.toString().snakeCase;
  final String? page = argResults?['page']?.toString().snakeCase;

  try {
    if (page != null) {
      _deleteTestHelpersForPath(
          PathHelper.getPageTestPath(apps ?? '', feature ?? '', page));
    } else if (feature != null) {
      _deleteTestHelpersForPath(
          PathHelper.getFeatureTestPath(apps ?? '', feature));
    } else if (apps != null) {
      _deleteTestHelpersForPath(PathHelper.getAppsTestPath(apps));
    } else {
      _deleteTestHelpersForPath(current);
    }

    StatusHelper.success('Successfully removed test helper files');
  } catch (e) {
    _handleError('Failed to remove test helper files: ${e.toString()}');
  }
}