CLI tools should emit only ASCII unless instructed to do otherwise (e.g. cat'ing a UTF-8 encoded file)


Fun fact: you can show a progress bar using only ASCII. But only do it if stdout/stderr isatty please

n | █==== | 20%
e | ██=== | 40%
v | ███== | 60%
e | ████= | 80%
r | █████ | 100%

Another fun fact is that your output can be coloured but so can be the background of someone's terminal. I think there is a way to check what the bg is (termcap?), but generally colour being opt in, or at least opt out is a good idea. So many programs just don't bother and hardcode colours.

Sign in to participate in the conversation
Mastodon is a private Mastodon instance for friends of SirCmpwn.