/// <summary> /// Sets interactive mode prompt to action that directly interacts with console and has a DI resolvable service dependency. /// It is recommended to use <see cref="InteractiveModeOptions.PromptForeground"/> and <see cref="InteractiveModeOptions.ScopeForeground"/>. /// </summary> public static InteractiveModeOptions SetPrompt <TDep>( this InteractiveModeOptions options, Action <TDep, InteractiveModeOptions, ApplicationMetadata, IConsole> prompt) where TDep : notnull { options.SetPrompt((provider, metadata, console) => { TDep dep = provider.GetRequiredService <TDep>(); prompt(dep, options, metadata, console); }); return(options); }
/// <summary> /// Sets interactive mode prompt to action that directly interacts with console and has a DI resolvable service dependency. /// It is recommended to use <see cref="InteractiveModeOptions.PromptForeground"/> and <see cref="InteractiveModeOptions.ScopeForeground"/>. /// </summary> public static InteractiveModeOptions SetPrompt <TDep1, TDep2>( this InteractiveModeOptions options, Action <TDep1, TDep2, ApplicationMetadata, IConsole> prompt) where TDep1 : notnull where TDep2 : notnull { options.SetPrompt((provider, metadata, console) => { TDep1 dep1 = provider.GetRequiredService <TDep1>(); TDep2 dep2 = provider.GetRequiredService <TDep2>(); prompt(dep1, dep2, metadata, console); }); return(options); }