You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to come up with a comprehensible output format for #115, I decided to play with colors in llnode commands outputs:
Not entirely sure if this is something we want to have on llnode since we'll need to detect if the terminal supports color (I have no idea how to do that), but if we decide to have it I can open a PR with it.
We can use an environment variable or a command line flag to control the colors (for example to work around tests or other cases where we need to redirect the output to a file)
BTW I have this when I need to write the output of a command to a file when it's too long to read in the terminal (e.g. the result of v8 findjsinstance)
~/.lldb/to_file.py
importlldbimportsysdefto_file(debugger, command, result, dict):
# Change the output file to a path/name of your choicef=open("/tmp/temp-lldb-output.txt", "w")
debugger.SetOutputFileHandle(f, True)
# Change command to the command you want the output ofdebugger.HandleCommand(command)
f.close()
print>>sys.stderr, 'Written to /tmp/temp-lldb-output.txt'debugger.SetOutputFileHandle(sys.stdout, True)
Ohh, nice script! I usually do lldb node -c core -b -o "v8 findjsinstances" > output.txt, but I need to quit lldb to use this :/.
I was thinking: we could have something like v8 settings set color on (off by default), and then use the llnode script to determine if the terminal is color-friendly. If it is, turn on color with --one-line "v8 settings set color on" before starting lldb. What do you think?
Edit: This would also make it easier to have an environment variable and a flag, as you suggested 😄
We can use an environment variable or a command line flag to control the colors (for example to work around tests or other cases where we need to redirect the output to a file)
If we do this (which I think we should) I think the standard thing I've seen is to set --color=auto, which outputs color if the stdout/stderr is a tty, and not otherwise. Then you can have always or never as options. That seems to be what other programs I've used tend to have.
I started working on a prototype, using the rang library. Any thoughts and ideas are welcome. The proposed flag is still missing, I just need some guidance to know if current work is ok.
Activity
joyeecheung commentedon Mar 22, 2018
We can use an environment variable or a command line flag to control the colors (for example to work around tests or other cases where we need to redirect the output to a file)
joyeecheung commentedon Mar 22, 2018
BTW I have this when I need to write the output of a command to a file when it's too long to read in the terminal (e.g. the result of
v8 findjsinstance)~/.lldb/to_file.py~/.lldbinitmmarchini commentedon Mar 22, 2018
Ohh, nice script! I usually do
lldb node -c core -b -o "v8 findjsinstances" > output.txt, but I need to quit lldb to use this :/.I was thinking: we could have something like
v8 settings set color on(off by default), and then use the llnode script to determine if the terminal is color-friendly. If it is, turn on color with--one-line "v8 settings set color on"before starting lldb. What do you think?Edit: This would also make it easier to have an environment variable and a flag, as you suggested 😄
joyeecheung commentedon Mar 22, 2018
@mmarchini SGTM
gibfahn commentedon Mar 26, 2018
If we do this (which I think we should) I think the standard thing I've seen is to set
--color=auto, which outputs color if the stdout/stderr is a tty, and not otherwise. Then you can have always or never as options. That seems to be what other programs I've used tend to have.src: colorize output for findjsinstances
Drieger commentedon Aug 21, 2018
I started working on a prototype, using the rang library. Any thoughts and ideas are welcome. The proposed flag is still missing, I just need some guidance to know if current work is ok.
Current work: master...Drieger:start_colorization
src: colorize output for findjsinstances
src: colorize output for findjsinstances
src: colorize output for findjsinstances
src: colorize output for findjsinstances
src: colorize output for findjsinstances
src: colorize output for findjsinstances
src: colorize output for findjsinstances
src: colorize output for findjsinstances