You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the example bellow I was expecting that running cli without specifying a subcommand would fail with the error "Required command was not provided." as it happens without using the host
However, it works fine and no errors pop up. It seems that UseHost calls HostingAction.SetHandlers extensions on the root command and it sets actions to all commands in the chain. As a result, this validation never sets the error.
Was it made intentionally? As a workaround I can use Validators and check that there are tokens provided in the arguments list, but it would be nice to keep the same behaviour as it works without using a host.
The text was updated successfully, but these errors were encountered:
In the example bellow I was expecting that running
cli
without specifying a subcommand would fail with the error "Required command was not provided." as it happens without using the hostHowever, it works fine and no errors pop up. It seems that
UseHost
callsHostingAction.SetHandlers
extensions on the root command and it sets actions to all commands in the chain. As a result, this validation never sets the error.command-line-api/src/System.CommandLine/Parsing/CommandResult.cs
Lines 46 to 55 in b7f0d1c
Was it made intentionally? As a workaround I can use Validators and check that there are tokens provided in the arguments list, but it would be nice to keep the same behaviour as it works without using a host.
The text was updated successfully, but these errors were encountered: