resolveNext method
CommandContext<OptionDefinition, T>
resolveNext(
- ArgParseResult<
OptionDefinition> argParseResult, - Map<
String, String> ? env, - ContextProvider provider,
- CommandContext<
OptionDefinition, T> ? prevContext, { - required CommandRunMode runMode,
Implementation
CommandContext<OptionDefinition, T> resolveNext(
final ArgParseResult<OptionDefinition> argParseResult,
final Map<String, String>? env,
final ContextProvider provider,
final CommandContext<OptionDefinition, T>? prevContext, {
required final CommandRunMode runMode,
}) {
final command = argParseResult.command;
if (command == null) throw StateError('ArgParseResult.command is null');
if (command is! AbstractCommand<OptionDefinition, T>) {
throw StateError(
'ArgParseResult.command is not an AbstractCommand: ${command.runtimeType}',
);
}
final context = command.resolveCmd(
argParseResult,
env,
provider,
prevContext,
runMode: runMode,
);
if (argParseResult.child case final ArgParseResult child) {
final nextContext = resolveNext(
child,
env,
provider,
context,
runMode: runMode,
);
context.next = nextContext;
} else {
context.next = null;
}
return context;
}