decline icon indicating copy to clipboard operation
decline copied to clipboard

Expose `val command: Command[IO[ExitCode]]` in `CommandIOApp`

Open lolgab opened this issue 8 months ago • 2 comments

If you want to show the help when handling errors in the IO part of the app, you need to call .showHelp on the command instance. This is not possible with CommandIOApp since it doesn't expose the app but creates and uses it on the fly. This PR adds a val command: Command[IO[ExitCode]] to CommandIOApp so you can have similar errors to the errors printed by validate but when handling IO errors in the app with .handleErrorWith in the application logic.

This came out as a problem while implementing https://github.com/Quafadas/live-server-scala-cli-js/pull/17 and the current workaround is to copy paste the --version option from CommandIOApp and move to IOApp

lolgab avatar May 29 '24 09:05 lolgab