Use isatty() to determine output terminal status

Send the line reset escape codes if the output is a tty. Useful for
testing on the command line.