ununhexium / cecho

A color echo alternative to echo and printf
MIT License
0 stars 0 forks source link

Should multiple names for the same style be avoided? #1

Open LukasLauterbach opened 1 year ago

LukasLauterbach commented 1 year ago

The spec defines multiple names for some styles. For example to get inverted colors the user can choose from five! options: invert, inverted, inverse, reverse, reversed.

Why did you choose to support this? Are there similar tools that use some of these so different users may intuitively try different ones?

I think that if it can be avoided, the spec should only specify a single one to avoid ambiguity. It can be confusing to see so many different variations resulting in the same outcome.

Maybe it would be better to support a short and a long version like - and -- options.

What is your opinion about it?

ununhexium commented 1 year ago

Hello,

This comes from multiples names mentioned in the different doc that I found. For instance this page mentions 2. https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797

The wiki pages mentions some more https://en.wikipedia.org/wiki/ANSI_escape_code

Then there's the English grammar where you could express the state as an adjective or as an imperative.

I went for the "be lenient with your inputs but strict with your outputs" idea and let people pick what sounds good for them. I have a second idea to let people configure custom keywords are rebinds, so I could officially support 1 keyword of each and let people add custom colors but that would in turn make it harder to use in scripts as the configuration would need to be shared along with the script.

I agree with the short/long version alternatives. That would be single/multiple letters like the color options. Here is a possible mapping: https://github.com/ppo/bash-colors

Notice how this introduces more alternatives for long names. I don't know how I would choose only 1 and reject the others right now. Maybe the long option(s) to support is/are the one that would match the only short option, but that still leave room for alternatives.

There's also the prefix style of doing things, like on router, where it's enough to type the beginning of a command and as long as it's unique, it's accepted.

with the styles blink and bold, b would be ambiguous but bl bli etc. would all map to blink while bo bol etc. would all map to bold. Using strong instead of bold would also lift the ambiguity for a single letter code. Maybe that's the best option, I still need to think about it.