exec method

  1. @override
Future<void> exec(
  1. ExecContext context
)
override

Run command.

The contents of katana.yaml and the arguments of the command are passed to context.

コマンドを実行します。

contextkatana.yamlの内容やコマンドの引数が渡されます。

Implementation

@override
Future<void> exec(ExecContext context) async {
  if (context.args.length <= context._index) {
    // ignore: avoid_print
    print(description);
    return;
  }
  final mode = context.args[context._index];
  if (mode.isEmpty) {
    // ignore: avoid_print
    print(description);
    return;
  }
  for (final tmp in commands.entries) {
    if (tmp.key != mode) {
      continue;
    }
    await tmp.value.exec(context._copyToChild());
    return;
  }
  // ignore: avoid_print
  print(description);
}