nategood / commando

An Elegant CLI Library for PHP
MIT License
798 stars 80 forks source link

Add an option to throw an exception or return instead of calling exit() #96

Open d0x2f opened 5 years ago

d0x2f commented 5 years ago

Calling exit aborts the entire application making it difficult work around in some situations, such as during unit tests or when the outcome of an invocation should be logged.

An option to throw an exception instead of calling exit would be great!

Relevant line: https://github.com/nategood/commando/blob/7ae153aa211c0686f139062856642e33bf8a86e0/src/Commando/Command.php#L460

tolidano commented 5 years ago

See my PHP 7.2+ fork/rewrite, which does neither: https://packagist.org/packages/tolidano/commandox

Happy to discuss further there.