command-line-api icon indicating copy to clipboard operation
command-line-api copied to clipboard

HostingAction for options handlers

Open derigel23 opened this issue 1 year ago • 3 comments

Currently System.CommandLine.Hosting.HostingExtensions.UseHost set HostingAction wrapper for command and its subcommands actions. But, options can have also own actions and they are not wrapped with HostingAction

derigel23 avatar Mar 15 '24 14:03 derigel23

To my knowledge, Options in System.CommandLine do not feature actions. Actions (or handlers, as they were called in older System.CommandLine versions) are features of commands. Could you please clarify what exactly you mean by saying "options can have also own actions"?

(Side note: In case you aren't already aware, please consider reading this announcement: https://github.com/dotnet/command-line-api/issues/2338 and issue threads following this announcement.)

elgonzo avatar Mar 15 '24 15:03 elgonzo

@elgonzo, there's the CliOption.Action property. It was added in https://github.com/dotnet/command-line-api/pull/2095 as Option.Action, largely intended for --help and --version.

KalleOlaviNiemitalo avatar Mar 15 '24 16:03 KalleOlaviNiemitalo

@KalleOlaviNiemitalo thanks for the clarification!

elgonzo avatar Mar 15 '24 17:03 elgonzo