alwaysai / alwayscli

A framework for building command-line interfaces in Node.js
Other
6 stars 2 forks source link

Added an optional postRun argument in runCliAndExit() #35

Closed olafzi closed 1 year ago

olafzi commented 1 year ago

Added an optional postRun argument in runCliAndExit() function, that is invoked right before processExit().

This allows for running any command at the end of the Cli execution, for example used to display an update message, if one is available, or a custom message in the future.

ericvanbuhler commented 1 year ago

I think it would be useful to allow async functions to be passed in. It would make writing the functions much easier since we won't have to use special non-async packages like we were trying.

Can you also add a simple unit test that verifies it gets called?

ericvanbuhler commented 1 year ago

The unit test looks good!