Extending the CLI

ImpaktfullCli is designed to be subclassed. You can add custom plugins to a CLI that builds on top of this package.

Subclassing ImpaktfullCli

class MyCli extends ImpaktfullCli {
  @override
  Set<ImpaktfullPlugin> get plugins => {
    MyCustomPlugin(processRunner: processRunner),
  };

  @override
  Future<void> run(ImpaktfullCliRunner<MyCli> runner) =>
      super.run(runner as ImpaktfullCliRunner<ImpaktfullCli>);
}

Creating a custom plugin

Extend ImpaktfullCliPlugin to get access to the process runner:

class MyCustomPlugin extends ImpaktfullCliPlugin {
  const MyCustomPlugin({required super.processRunner});

  Future<void> doSomething() async {
    await processRunner.runProcess(['some', 'command']);
  }
}

Running your CLI

void main(List<String> args) async {
  final cli = MyCli(arguments: args);
  await cli.runCli();
}