setup example cli as bin script; add color detection

i found the example script is so useful it should be exported as binary via composer.

also added color detection, so you can use the cli tool to format and when redirecting to file, it won't contain ANSI escapes, but if output to terminal, then it will be colored.