runChildCommand method
FutureOr<String?>
runChildCommand(
- List<
String> path, - ParsedInputs inputs,
- List<
String> args
inherited
Implementation
FutureOr<String?> runChildCommand(
List<String> path,
ParsedInputs inputs,
List<String> args,
) async {
if (path.isEmpty || path.contains(name))
throw ArgumentError.value(path, 'path');
Command? current;
List<Command>? children = commands;
for (final part in path) {
current = children
?.where(
(candidate) =>
candidate.name == part ||
candidate.aliases?.contains(part) == true,
)
.firstOrNull;
if (current == null)
throw MambaException('command not found in $name ${path.join(' ')}');
children = current is GroupCommand ? current.commands : null;
}
return current!.run(inputs, args);
}