We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command
What is the easiest way to get Command and its Options or Arguments when configuring the host?
Options
Arguments
is this the best way?
public static bool TryGetGlobalInputOption(this IHostBuilder hostBuilder, [NotNullWhen(true)] out string? filename) { var invocation = hostBuilder.Properties[typeof(InvocationContext)] as InvocationContext; var command = invocation!.ParseResult.CommandResult.Command; var inputOptions = command.Options.FirstOrDefault(f => f.Name == "input"); filename = null; if (inputOptions != null) filename = invocation.ParseResult.GetValueForOption(inputOptions) as string; return filename != null; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What is the easiest way to get
Command
and itsOptions
orArguments
when configuring the host?is this the best way?
The text was updated successfully, but these errors were encountered: