runSimpleCliAdapter function

Future<int> runSimpleCliAdapter(
  1. List<String> args,
  2. Future<int> execute(
    1. List<String>
    ), {
  3. String helpText = 'No options for this command.',
})

Runs a CLI adapter that accepts no options. Skips ArgParser construction entirely; just intercepts --help/-h and otherwise calls execute with the raw args (allowing the executor to inspect positional arguments).

Implementation

Future<int> runSimpleCliAdapter(
  List<String> args,
  Future<int> Function(List<String>) execute, {
  String helpText = 'No options for this command.',
}) async {
  if (args.contains('--help') || args.contains('-h')) {
    stdout.writeln(helpText);
    return 0;
  }
  return execute(args);
}