I got tired of seeing red messages in my provisioning script out, so I set out looking for a solution.
The problem, red lines from non errors makes it difficult to spot some genuine errors.
The requirements for a solution, accept any command and show green output for all commands that succeed.
The solution: a shell function that accepts a description and command, returns success messages for commands with a zero exit code, returns the output of a command for non zero exit codes.
I have decided to share the function with the vagrant community in the hope some of you find it useful. You can find the project on Github:
Example usage:
exe "Update apt indexes" \
sudo apt-get update
Provisioning output:
==> Execute: Update apt indexes
==> ...
==> ...
==> ...
==> ✔ Success
Example of the default vagrant output from a fully functioning provisioning script that calls openssl and php composer command:

Example of the same script using my exe function:

And output should there be a genuine error in your script:

This script function has only been used by myself and isn't widely battle tested. I'd love feedback and fixes for edge cases through Github. Hope this makes a few lives a little easier :)