run method

Future<void> run()

Runs the feature manager interactive loop.

Displays the feature list and allows the user to add new features or manage existing ones.

Implementation

Future<void> run() async {
  while (true) {
    final features = _getFeatures();
    Console.printFeatureList(features);

    final options = <String>[
      ...features,
      '➕  Add new feature',
      '🚪  Exit',
    ];

    final idx = Console.selectFromList(
      '🗂️  Feature Manager — What do you want to do?',
      options,
    );

    if (idx == options.length - 1) {
      // Exit
      Console.info('Goodbye! Happy coding 🚀');
      break;
    } else if (idx == options.length - 2) {
      // Add new feature
      await _addFeature();
    } else {
      // Manage existing feature
      await _manageFeature(features[idx]);
    }
  }
}