Open jquorning opened 1 year ago
Thanks for the suggestion. More generally, there are some defaults that are now hardcoded that we may want to make overridable (possibly using our config mechanism) and this could be a good fit.
As a start is suggest a HTML TTY driver package:
src/general
ALR_Text_IO
TTY driver accepting HTML \<b> \<i> \<em> \<br>, perhaps \<a>If that sounds like a plan you may assign me the issue.
I agree on the spirit of the idea, but I don't think we need to go with HTML. We basically have a series of predefined styles (crate name, version, code, url, emphasized, etc.) that we are already using mostly consistently. We would need a way to redefine these styles.
I think if we were to adopt an extra formatting library, we would end duplicating the boiler plate. We now have, for example:
Put_line ("Crate " & TTY.Name (Crate_Name) & " not found")
and going to tags we'd have
Put_line (TTY.Format ("Crate <name>" & Crate_Name & "</name> not found")
Although if at some point we wanted to go multilingual, having a way to completely excise strings from code would be necessary, and in that case I can see it working like that.
Indeed the best solution right now is to introduce those themes in https://github.com/alire-project/alire/blob/master/src/alire/alire-utils-tty.ads
and have a configuration value to change the default.
I suggest refactoring handling of colors and
--no-color
into a new command line switch:--look=<theme>
where theme:--no-color