Is it possible to render or print bold or stylized text in the build log? - google-cloud-build

I used a bash function to print out manually echo'd messages in bold, but it renders as normal text in the build log.
Is it possible to render the text a different font style or color in order to make it stand out when reviewing logs?
Edit-
Per the request in the comment (thanks Sathi) what I tried to were two techniques outlined here: How does one output bold text in Bash?
The tput method fails because there is no terminal to interact with, while using echo -e '\033[1mYOUR_STRING\033[0m' renders normal text. I understand why both of these would not likely work as there is not a terminal. I thought perhaps there would be an escape sequence or some other method specifically for the cloud build logs as viewed in cloud build, but I haven't seen anything when searching.

Related

Getting a 'line background color pattern' on Bash

I use gnome terminal / Bash on Ubuntu 18.04 (the default one).
When I get some command outputs with several long lines after each other, my eye has difficulty to follow which line some later column belong to.
One good solution to avoid this problem is to use a line-based background color pattern, for example I would do the following in LibreOffice
Is there a way to get something similar in Bash? I.e. to get on bash a user-parametrizable alternating background color on a line basis? I looked for it quite extensively but did not find any resources so far.
Edit 1
Opened an issue there asking for feature: https://gitlab.gnome.org/GNOME/gnome-terminal/issues/175

Is it possible to separate STDOUT context by its colour?

I'm using the output of the excellent package icdiff (https://github.com/jeffkaufman/icdiff) to check for differences between updated iterations of files. I'd like to parse out just the significant differences though. From the package --help I can't see any in-built options (and for full disclosure I've 'cross posted' at the github issues page to see if it can be added or I've missed something).
This has got me wondering whether a hacky solution might be to parse out the lines by their colour, since they are also colour coded by 'severity of difference'. Is this at all possible in bash? (Alternative approaches are welcome too!)
Here's a sample of the output (I can only think to add a picture here since the markup wouldnt show colour). I'd like to get just the lines where the whole line is solid red/green for instance. Excuse some of the screen wrapping, my monitor isn't wide enough and the text is small enough already.
with GNU Grep, for example
grep -Po $'\e\[31m\K.*(?=\e\[\d+m)'
to extract text in red,
\K to keep the left outside match, like a lookbehind
(?=..) lookahead assertion 0 length match
you can grep on the ANSI escape sequences, e.g. (with 31 for red):
grep '^[\[31m' # make the escape character (^[) by typing ctrl+v ESC
but you need to make sure your output stays colored if it is not sent to a terminal : (many programs will make their output B&W when output is not a terminal. - you can check it with less, which will show you the escape sequences)

iterm2 images not displaying inline

iTerm2 has a feature that can be used to display images in the terminal, see https://iterm2.com/documentation-images.html for documentation on the protocol.
I have been able to produce an image in the terminal by using the correct ASCII characters and encoding; this string (starts with ESC and ends with ^G)
]1337;File=inline=1:iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABQtJREFUeNrsVktoXVUUXefc7/vmpUmaNonWSsFYtBZEWhRKERxI60QF6UhBOhAVEXEmzjrVQbXgTBRFB4oTlSq1FEGEiggWlKpVjG0wn9fXvE/u75zjOucmaVIrWhBB6IX9eO9+9tpr7bX3fcIYg//yENcB/33As+PX9oStr8GPvsClJ0dG1AXviIiKSYyJ1+SucFEI3KqXknFZHxpH7n0sW9Xj8UPjEA0Jk2j41wBU5+ejaOnH0NChansLmMjugB+MeDs0REsclGEC4ZHFuEAxPwOVNYfjA5PH5UgAfSnnhX/KUOFZNPWLjFZxxkd6OoKeq0COePCaPkTsQZKaKgCtDALSyM9eBG65+WLlwelZ9Usn5A0xM7X9v5VPYD8m1Ut6VmD5/RrUuRpkVEFwk4RsSRbDsgvhqi9yTVCF0LOPSohMDZtePkyw1YxTPmR+ZVft3SGKMEOEOzFanEw/D5B+2oTwa4h3kVGF/cgJVjDIzDbG1hZ7BkZJELY8f9mQbcZeRubPZY2N6hkPkTGjm0Y7J1AV04N3qshPDyHcWYE/YRvvwRSk4Et4nge9klMbjbzQ8KQpi4ZYn3aYcR/jmP9Jd3KVmtPQaIV+rfnEnu789O435hfUr63Ryt0VWJ1MSiA2SHgEFhLLJBJaYD5qpUyJXvM9mwXrZFxN/irjqB/IjaYxYfyAbuoXsjeX5nC+IaJ9MaSxmnlQTOZZQMnvKwWSEiU08HhLg8gqZ4uMWIezdhxjvEdz1VFGlW0OH1/YfO9bO0/UsGfu583FvuqYVAGWEoEBAYM4RGYkUiaUBK/XAgQBGdl+ybKfQogVHLHOee44xfiMd1nT5BA6fbk7Wj+8+dv58/d8dRrYvQlKhTBkE0ZlYsGkmRbIGT4l7nKQ+xmHmeCSEs4spjynqLq8muffZfTXxqKIw0T01I37Tr4+FGxPkcQTkLS8Zq+qse8YMTea1cAx0dqacEVWUfJoWcYUW+niaoBzjC8doGCzl4Yrvds/PLt1S95HOjUBn89IslIETHODPFeoVUO62NCgJYNGxXPWL2gYwxytGn8XBkl21f18yEpqAR/JqsFv9Zn+/TvPsYgdQxxNgX5hZ0pjqBGUgBouuUfp+knuxqFe8Z073Xmy7A0K5FmOZmyXk7nSOEcYJ32+Lp7rN6O7bvvivGqpZaRDY24XWFdra3eCxmRaZxRORzt0Tk9Y5TxXh3bFkSacZ9cGfgNTO/h7pfLlN1E7w7bZRQ9bIyCBq74SCtQj4QC5ILHUzVg96y4KWCUbvC6UQq+fIUncEnWbxp7XtiD9J1mfsXR9ynl40/cdjA36UDfUWKmhJ4wDEsatdyY2iKxRCu12pKGKqbK95HgovcbEskzygm62U7oBkJscH9ldKgfV8FS8nCDUuZPQVtfp8TtNYte/pG5JkqHTTZicTPLMbmmolIyTFFUm5+Llqyh392v2VOelvG6fXl5tPzBm2HWzf9tPS0eNNE8hZPPZg0bAyr3CDbOdL9uvZcrXFNyVXjkSlbgkVth+uZk3rndxZLePRiapUOQtilpwDgsmWnk9dcSPbx/A9u/ajV7S+VqExQ52plz0q6LYfAQNCJQpg7/+R7JygTdwkvjCzWDioVeqD08/LbfEMINyNv3ts33o0WrX/J4/X1xoHyRMzmrW0ppyrt0rT7On7rcwV+xls3ECjHsuxuLgg/xMG/HUVLn+bDHX/yb+7wH/EGAARjZ2jNWjuZgAAAAASUVORK5CYII=
will produce this output:
however, when I attempt to display another image along side, this happens; string
]1337;File=inline=1:iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABQtJREFUeNrsVktoXVUUXefc7/vmpUma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ENaPQTg3vGXiBQmYISBN0xjkShBQX6dM6ADaP4a6pn1D/9ezJ5orqDmESlgtFQ3OA39BmLwXUxiLkRjVGZPtBOwFbRmaol6GSh2HSnfF3KfKoaA+GeZeMOo5G4a9rYNvunWtES6/JoyBeXhYP0x6/FDCnQiqhJCDzR3BNsVQjRSBVZNnRremBopobXY0kY40yWo9OepRhsrqOa7J2+cbvj0w2RkstYexFlb5Ju3tQMJYJBs6zEfhkqFQOik6T57oQUKubF0IuB8wtN8q0A7OIuGixmcFtXiYTuH4EG4/O4tiJVdvTYX+PH+erXYSv0LYuxWb79e/6DfmylD+BJEcWAUzOVmZcg3VlQeM4XvUKMM3rQmP9KkhGSqjpLtYdnNnaHg73CWtflv2wXhrgkx4abjQUsAaVLQDiOEernUKw6N19MktHcrY/jUYzLZ5xgNWQc5wvGHSZmwxx3ek5Fc6n0J7c7wBX076mnV+qRJczgrCoXXS8YFKpMI46zdDtJDBstLZ/PxSmcKQAZa4dsFOYo1uPlTDRaWPs+CLSsr/D5fDE4PkhChoN5Ve87kjXygQC8qQoim6cFd77zJ97QHLvhU5eRBa4qB07BG3w3lBIH4gQmAxRN0anHOx1gD/Sau54EhU/EaFab6UZD0suMi523ote12E8CINeU3Cl4bqWE1NXZ6jywh1lmseK5JqhKhXsjpiAkVJQ1x1pvHtkq33RnYe9wMqsozP04vPpd0S8+IIcCVygvYgHFIzLCAkI5JTqyqffpIq0FHXr/lLvcDWq3Xrs5rGmd2GVYGfJDs6z43d28YipiFYeL6uSZaBLr5WuCThAF5WxvRkhBsTHGeGryZGvzIpyc93pNs/V/99L/+2AfwkwAIpSa6LlmvuQAAAAAElFTkSuQmCC
produces
The images are not inline.
How can I ensure consecutive images remain inline? I am able to repeat the result in zsh, and bash. I am on iTerm 2 Build 3.0.4.
Thanks!
There are two solutions:
1> Insert \b\33[1A at the beginning of the second and third image, change the count of \33[1A according to the height of image (in your case, it appears once). The meaning of escape sequences can be referenced here.
\e]1337;File=inline=1:iVBORw0KGgo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KNDNv0knDXDY6/50fqHfLkSvqyjN64sAL+j7e2B2CVQ9y+KL7olC3DfV6gyfy7axAqkpNuPAjKo0IgFpPaRbytP3DF7rL7x2wrO1e/5WCJ4Rogyt6kW5gDbtE8vVZNP2posgxNzCfEENaPQTg3vGXiBQmYISBN0xjkShBQX6dM6ADaP4a6pn1D/9ezJ5orqDmESlgtFQ3OA39BmLwXUxiLkRjVGZPtBOwFbRmaol6GSh2HSnfF3KfKoaA+GeZeMOo5G4a9rYNvunWtES6/JoyBeXhYP0x6/FDCnQiqhJCDzR3BNsVQjRSBVZNnRremBopobXY0kY40yWo9OepRhsrqOa7J2+cbvj0w2RkstYexFlb5Ju3tQMJYJBs6zEfhkqFQOik6T57oQUKubF0IuB8wtN8q0A7OIuGixmcFtXiYTuH4EG4/O4tiJVdvTYX+PH+erXYSv0LYuxWb79e/6DfmylD+BJEcWAUzOVmZcg3VlQeM4XvUKMM3rQmP9KkhGSqjpLtYdnNnaHg73CWtflv2wXhrgkx4abjQUsAaVLQDiOEernUKw6N19MktHcrY/jUYzLZ5xgNWQc5wvGHSZmwxx3ek5Fc6n0J7c7wBX076mnV+qRJczgrCoXXS8YFKpMI46zdDtJDBstLZ/PxSmcKQAZa4dsFOYo1uPlTDRaWPs+CLSsr/D5fDE4PkhChoN5Ve87kjXygQC8qQoim6cFd77zJ97QHLvhU5eRBa4qB07BG3w3lBIH4gQmAxRN0anHOx1gD/Sau54EhU/EaFab6UZD0suMi523ote12E8CINeU3Cl4bqWE1NXZ6jywh1lmseK5JqhKhXsjpiAkVJQ1x1pvHtkq33RnYe9wMqsozP04vPpd0S8+IIcCVygvYgHFIzLCAkI5JTqyqffpIq0FHXr/lLvcDWq3Xrs5rGmd2GVYGfJDs6z43d28YipiFYeL6uSZaBLr5WuCThAF5WxvRkhBsTHGeGryZGvzIpyc93pNs/V/99L/+2AfwkwAIpSa6LlmvuQAAAAAElFTkSuQmCC\a
The text I pasted above is the content of file /tmp/three
2> Merge the images use ImageMagick, which you can reference here.
Please let me know if these two solutions can't solve your problem properly.

MacVim Command Window text coloring help (Rspec output)

I'm trying to transition to MacVim for ruby dev. One of the hangups I have is running specs quickly and getting results (passes/failures) easily.
When I run :Rake (or :!rspec %) it runs the specs in the current file. The output is shown in the command window.
If I run this in regular Terminal, I get colored output. That is, the dots are green and the failures are red.
In MacVim, I get these weird [32m and [0m tokens. Here's an example:
Any ideas on how to fix this?
Gvim (and I assume Macvim is just that with a brand-name :) ) doesn't have a real terminal behind it, so that's why you're getting these 'weird' tokens - they are the escape codes a real terminal would interpret as colors.
As michaelmichael points out, getting vim to like ANSI escape codes is bothersome. Also, I like his suggestion of vim-rspec. I cobbled this (https://github.com/dahu/VimTestRunner) together as a lightweight rspec test runner. It shows a red/green bar in your Vim status line when you run the tests. You can run just the rspec associated with the current file using <leader>y or all rspecs in the current directory with <leader>a. Feedback and suggestions for improvement welcome. Oh, and it's quite alpha at this stage. Be gentle. :-)
Use vim-rspec. It'll give you the clean, nicely colored rspec output you're after:
BTW, those are ANSI escape sequences messing up the output. See here for a question I asked a few weeks ago about getting rid of them while viewing ri documentation in (Mac|g)vim. Bottom line: it's easier to try to get plain text output than to try and shoehorn support for ANSI escape sequences into Vim.

Text editor/viewer with ANSI codes rendering support for Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I need some tool to display text containing ANSI codes correctly on Windows. No full support needed, but at least coloring/bold is a must.
Reason: My logger/debug module produce nicely rendered rich output with important sections colored using ANSI codes. This helps a lot when debugging on the serial terminal, but if I dump the debug to a file or copy-paste it into a text editor on Windows (interactive remote debug is not always viable), at best all the ANSI codes are stripped, at worst they are rendered as junk characters obscuring the real data. Rudimentary editing capabilities would be appreciated to be able to pick out specific parts, annotate, and so on.
The open-source editor Atom has the package language-ansi-styles. It supports all kinds of formatting except ;r;g;b.
You might have some more luck with ASCII/ANSI utilities, like the ones listed here:
List of ASCII/ANSI/NFO utilities
**Note: some files on this page might be outdated, you might find newer versions of these utilities on their respective homepages.*
For example, the latest version of NFOPad can be found here.
I've been looking for a solution to display the ANSI colors as well (for program debug output readability) and stumbled upon Sublime Text (paid software with trial http://www.sublimetext.com/) with a the ANSIescape package (https://github.com/aziz/SublimeANSI or installed through the package control).
It supports coloring and the bold escape is recognized but not displayed, although a special color can be assigned to it in the settings file. Also worth noting that this plugin shows text in read-only mode, and needs to be turned off if editing is necessary.
Here is the screenshot provided on the github, and I have personally tried it and verified it works:
If you're primarily interested in viewing the file instead of editing it, Ansifilter will convert it to HTML, which you can then view and at least search in your browser, or RTF if wordpad would be good enough (hard to imagine). Huh, looks like there's a notepad++ plugin version on the download page, too, so that might be perfect if it allows you to load into notepad++.
http://www.andre-simon.de/doku/ansifilter/ansifilter.html
There's also a different plugin for vim which colors text according to ANSI codes.
http://www.vim.org/scripts/script.php?script_id=302
However, while it highlights the text in the correct color, it leaves the ANSI codes themselves in there (in a faded, near-background color) which probably will mess up any alignment formatting in the file, as well as making it harder to move around the file (lots of "empty space" to wade the cursor through, searching for a word won't match if there's an ansi code in the middle of it, etc.). There's a patch it can take advantage of to hide the codes too, but that would require patching and then recompiling vim itself from source.
Yeah, suggesting vim is pretty unhelpful if you aren't a vim user already, it has too huge of a learning curve, I know. But it might be useful to the vim users out there.
I know it won't be of much help - but I was looking for the exact same thing on linux; was just trying to view some log outputs that had bash ANSI color codes inside. Unfortunately, those ANSI color codes were spread across several lines - meaning 'cat'-ing the file and piping into 'less -R', 'most' and similar tools, would simply display the starting line where the color originated, but not the subsequent lines that should've been colored.
Funnily enough, I thought usual Linux tools like 'nano', 'gedit', 'vim' and whatnot would have capabilities for ANSI color codes in a text file, but it's very modest out there with info on ANSI color in text files in these editors. I've only found info on ANSI color for the test editor 'joe':
Cheap ANSI Color! - http://tldp.org/LDP/LG/issue01to08/articles.html#ansi
but couldn't get the recommendations there to work (also couldn't get 'emacs' to work either, at least not by directly reading a text file with ANSI color characters inside).
The good thing - it seems what you need, if you need ANSI color in text, is to look for ASCII art / NFO utilities as recommended above - and the one that I finally found, and was working for me, was tetradraw (via www.linux.org/apps/AppId_42.html ; can be sudo apt-get installed in Ubuntu ... actually, tetradraw is the name of the drawing/editor part - however there is a separate viewer that also works with ANSI color codes, tetraview).
Well, who would have thought, that you need to track down an ASCII art utility, in order to read log files :)
Anyways, hope this may somehow help in the further search of ANSI color text editors for Windows, too.. Cheers!
If you just want to view then the terminal program "Tera Term" can do this. Just click "File" -> "Replay Log" and select your file containing the ANSI codes.
You can download Tera Term here:
http://logmett.com/index.php?/download/tera-term-477-freeware.html
In Emacs, just eval the following before opening your .nfo file:
(add-to-list 'auto-coding-alist '("\\.nfo\\'" . cp437-dos))
I have been a while testing multiple programs on the URL refered by Andras Vass with no results (they don't show colors, or they keep showing ANSI codes as a mess of characters).
Tired of searching I have finally found ANSIFilter (not the NotePad++ plugin refered by Jeffson), the only that works for me.
I have added it to Windows context menu, so I can now easily open my ANSI text files.
I would be surprised if emacs can't do that.
At least with the embeded shell.
There are:
http://www.emacswiki.org/emacs/AnsiTerm
http://www.emacswiki.org/emacs/MultiTerm
http://www.emacswiki.org/emacs/ansi-color.el
Update: as it had been pointed, they are just term output colorizers. But if you can edit the shell buffer contents in emacs too, eg. cat file && colorize.
But wait a minute, I had just found these:
http://vaperized.com/ansiexpress.htm
http://www.syaross.org/thedraw/
http://picoe.ca/products/pablodraw/
If the debug logging of your application goes via 1 class/function, you could try to split the output so that:
ANSI-like logging is shown on the terminal/console
HTML-like logging is written to file
For your application all logging goes to this class, and this class splits the output to terminal/console and file.
Make a 'standard' in your logging class for specifying colors and boldness (e.g. predefined codes like Ctrl-A means red, Ctrl-B means bold, ..., or specific methods in the logging class for setting the color and boldness, or maybe even the ANSI-codes), and translate this in your central logging class to:
the correct ANSI codes on terminal
the correct HTML codes in file
Alternatively, I think that instead of HTML you also could use rich-text, but I don't know all the possibilities of rich text so you may have to look this up.
You could try notepad++ (see http://notepad-plus.sourceforge.net/uk/site.htm). It's pretty powerful (Scintilla based) and has an option to view non-printable characters (like line-breaks and the like).

Resources