dfinity / ic-repl

Apache License 2.0
70 stars 10 forks source link

For readability, is it possible to add a color to call responses or any other variable? #54

Closed fermartz closed 1 year ago

fermartz commented 1 year ago

@chenyan-dfinity First of all, thanks for putting together this awesome tool 🙌 .

In bash you can the do the following and change the color of some text. I was wondering if it would be possible to do the same in the test scripts? If so, how?

LIGHTBLUE='\033[1;34m'
NOCOLOR='\033[0m'

echo -e $LIGHTBLUE

echo "My text with light blue color"

echo -e $NOCOLOR

echo "My text with default bash color"

Thanks !!!

chenyan2002 commented 1 year ago

This ties to a more general question of how we display string/result. Currently, the result of expressions are all display on screen. This is great for REPL, but can be too noisy for scripts. Also string is using debug print, so these control escapes won't work.

We can add an echo command that displays the unescaped string, and omit displaying expression result without echo command. This would be a breaking change though.

fermartz commented 1 year ago

Thanks for the explanation. Since I couldn't find a way to do it directly in the script I raised the question here. Adding colors is just a 'nice to have' feature, not a big deal. I will close the ticket.