SUMMARY I am trying to figure out how to convert a log to HTML. The build log contains terminal control sequences. I know I can achieve it using Konsole by streaming it and saving the buffer as HTML. I would appreciate a command line option --save to automate this process. STEPS TO REPRODUCE 1. { konsole -s >out.html -e cat out.log; } OBSERVED RESULT Unknown option "-s"! EXPECTED RESULT A HTML version of the log in file out.html. SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: openSUSE Tumbleweed 20210615 (available in About System) KDE Plasma Version: 5.22.0 KDE Frameworks Version: 5.82.0 Qt Version: 5.15.2 ADDITIONAL INFORMATION
A workaround using xdotool: konsole -e 'sh -c "rm ~/colors.html; cat ~/colors.txt; xdotool key ctrl+S; sleep 1; xdotool type ~/colors.html; sleep 1; xdotool key Return; sleep 1"' This workaround uses xdotool to invoke the "Save Output As..." menu, then writes the filename, and sends a Return key to invoke the default "Save" button. The "sleep"s are important. They let the previous action complete before invoking another action. The last one prevents Konsole from exiting before it has completed the save action.
(In reply to ninjalj from comment #1) > A workaround using xdotool: > > konsole -e 'sh -c "rm ~/colors.html; cat ~/colors.txt; xdotool key ctrl+S; > sleep 1; xdotool type ~/colors.html; sleep 1; xdotool key Return; sleep 1"' > > This workaround uses xdotool to invoke the "Save Output As..." menu, then > writes the filename, and sends a Return key to invoke the default "Save" > button. > > The "sleep"s are important. They let the previous action complete before > invoking another action. The last one prevents Konsole from exiting before > it has completed the save action. This workaround requires starting a separate display, I am afraid.