Require an option
Use [RequiredOption] when a command cannot run without a named option.
public sealed partial record DeployParameters
{
[RequiredOption("--environment", "-e")]
public required string Environment { get; init; }
}
deploy --environment staging
deploy -e staging
If the option is omitted, AnyCLI reports a structured command-line error before the command runs. The default command-line error exit code is 2.
[RequiredOption] does not have a DefaultValue; use [Option] with a default when omission is allowed.