invocation property

  1. @override
String get invocation
override

A single-line template for how to invoke this command (e.g. "pub get package").

Implementation

@override
String get invocation {
  final parents = <String>[];
  for (var command = parent; command != null; command = command.parent) {
    parents.add(command.name);
  }
  parents.add(runner!.executableName);

  final invocation = parents.reversed.join(' ');
  return subcommands.isNotEmpty
      ? '$invocation <subcommand> [arguments]'
      : '$invocation [arguments]';
}