run<O extends OptionDefinition, R> method

  1. @override
FutureOr<R?> run<O extends OptionDefinition, R>(
  1. CommandContext<O, R> context
)
override

Runs this action option. context is the context of the command that defined this action option.

Implementation

@override
FutureOr<R?> run<O extends OptionDefinition, R>(
  final CommandContext<O, R> context,
) {
  final completionShell = context.builtinConfig.optionalValue(
    BuiltinGlobalOption.completion,
  );
  if (completionShell == null) {
    throw StateError('Completion shell value is null');
  }
  // (Exits the process after writing the script if
  // CompletionSettings.exitAfterResponse is true.)
  return printCompletionScript(
    context.command.runner,
    completionShell,
  ).then((final _) => null);
}