3 ms·
> I've recently been porting all of our shell scripts to have color text output and Unicode status indicators I kinda have a similar intent of revamping user U
by kasabali 10y ago
> I've recently been porting all of our shell scripts to have color text output and Unicode status indicators
I kinda have a similar intent of revamping user UI and user interaction of my personal scripts so I would appreciate some insights. Do you have any specific tips, helper functions or code snippets you can point me to? Do you just copy, paste and modify code snippets around when needed or have a clearly defined and reusable functions for printing, listing, displaying, prompting things etc.?
- SwellJoe 10y agoI just published the colorized logging library I am using (it's a rewrite of log4bash to support POSIX shells): https://github.com/swelljoe/slog/ https://github.com/swelljoe/slog/ I also have a few other functions I'll be wrapping up into a utility function library, once I make them all work nicely across all of the shells I'd like to support. I'm mostly working from functions I wrote years ago and haven't touched in the interim (except to make them work with POSIX/dash, when Ubuntu switched /bin/sh from bash for 6.06).
- kasabali 10y agoThat's great, thanks! I'm keeping an eye on other functions, too.
- SwellJoe 10y agoJust pushed out an asynchronous (cooperative, it requires the child process to touch a file to let the spinner know when to stop) Unicode and colorized progress spinner: https://github.com/swelljoe/spinner https://github.com/swelljoe/spinner I wouldn't call this one production ready yet. It needs to be in a function and needs to get its variables scoped and such. But, I was curious to see if a POSIX shell script could be coaxed into doing those super fun spinner designs with goofy shit like happy faces or peace signs or the like. And, it turns out you can. Long code points don't work, anywhere that I tried, yet...so my dream of a clock face with a moving hand is not yet possible. But, some day, it'll happen.