leancodepl / patrol

Flutter-first UI testing framework. Ready for action!
https://patrol.leancode.co
Apache License 2.0
860 stars 127 forks source link

Introduce a simple abstraction over `Command` #265

Closed bartekpacia closed 2 years ago

bartekpacia commented 2 years ago

Currently patrol_cli has basically one main command, drive. It's class, DriveCommand, is too big, and I think it could benefit from the following abstraction:

/// Command which first prepares its config before executing.
abstract class StagedCommand<T> extends Command<int> {
  void createOptions(ArgParser argParser);

  Future<T> prepare();

  Future<int> execute(T config);

  @override
  @nonVirtual
  Future<int> run() async {
    createOptions(argParser);
    final config = await prepare();
    return execute(config);
  }
}
github-actions[bot] commented 10 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.