nickderobertis / terminhtml Goto Github PK
View Code? Open in Web Editor NEWRun commands in your shell and convert into an animated HTML/CSS terminal
License: MIT License
Run commands in your shell and convert into an animated HTML/CSS terminal
License: MIT License
The --cwd
option works as expected, while the -c
one results in:
/usr/bin/bash: line 1: /home/pawamoy/data/dev/griffe: Is a directory
% pipx run terminhtml -c $PWD "make format" > output.html
Traceback (most recent call last):
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 113, in _get_real_output_and_context_from_output_lines
command_marker_indices = CommandMarkerIndices.find(lines)
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 204, in find
raise CannotFindPersistenceLineMarkersException(
terminhtml._exc.CannotFindPersistenceLineMarkersException: Could not find all command markers in lines: [LineOutput(line='/usr/bin/bash: line 1: /home/pawamoy/data/dev/griffe: Is a directory', time=datetime.datetime(2022, 9, 25, 15, 55, 24, 701782), line_ending=<LineEnding.CRLF: '\r\n'>, prompt_output=None), LineOutput(line='', time=datetime.datetime(2022, 9, 25, 15, 55, 24, 701932), line_ending=<LineEnding.CRLF: '\r\n'>, prompt_output=None)]. Markers were: markers=CommandMarkerIndices(begin_persistence=-1, end_persistence=-1, begin_path=-1, end_path=-1, begin_env=-1, end_env=-1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 34, in run
return _run(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 333, in _run
real_output, new_context = _get_real_output_and_context_from_output_lines(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 117, in _get_real_output_and_context_from_output_lines
raise CommandInternalException(
terminhtml._exc.CommandInternalException: Command had non-zero exit code
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/bin/terminhtml", line 8, in <module>
sys.exit(main())
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/cli.py", line 157, in main
typer.run(run_commands_create_html)
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/cli.py", line 138, in run_commands_create_html
term = TerminHTML.from_commands(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/main.py", line 59, in from_commands
command_results = _run_commands_create_command_results(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/main.py", line 137, in _run_commands_create_command_results
return run_commands(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 96, in run_commands
out_command = run(command, last_context, input=this_command_input)
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 56, in run
raise UserCommandException(
terminhtml.exc.UserCommandException: Command failed: /home/pawamoy/data/dev/griffe due to Command had non-zero exit code as part of running commands=['/home/pawamoy/data/dev/griffe', 'make format'] setup_command='' input=None
context=cwd=PosixPath('/tmp/tmp7csrmz5b') env=None
output:
/usr/bin/bash: line 1: /home/pawamoy/data/dev/griffe: Is a directory
(by the way, it seems that blank lines are inserted between each line, is that expected?)
Passing .
to the --cwd
option fails. As a workaround, I pass $PWD
instead. I guess the given path should be resolved before entering any temporary directory? Didn't look at the code yet.
% pipx run terminhtml --cwd . "make format" > output.html
Traceback (most recent call last):
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 113, in _get_real_output_and_context_from_output_lines
command_marker_indices = CommandMarkerIndices.find(lines)
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 204, in find
raise CannotFindPersistenceLineMarkersException(
terminhtml._exc.CannotFindPersistenceLineMarkersException: Could not find all command markers in lines: [LineOutput(line="make: *** No rule to make target 'format'. Stop.", time=datetime.datetime(2022, 9, 25, 15, 57, 46, 216178), line_ending=<LineEnding.CRLF: '\r\n'>, prompt_output=None), LineOutput(line='', time=datetime.datetime(2022, 9, 25, 15, 57, 46, 216390), line_ending=<LineEnding.CRLF: '\r\n'>, prompt_output=None)]. Markers were: markers=CommandMarkerIndices(begin_persistence=-1, end_persistence=-1, begin_path=-1, end_path=-1, begin_env=-1, end_env=-1)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 34, in run
return _run(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 333, in _run
real_output, new_context = _get_real_output_and_context_from_output_lines(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 117, in _get_real_output_and_context_from_output_lines
raise CommandInternalException(
terminhtml._exc.CommandInternalException: Command had non-zero exit code
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/bin/terminhtml", line 8, in <module>
sys.exit(main())
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/cli.py", line 157, in main
typer.run(run_commands_create_html)
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/cli.py", line 138, in run_commands_create_html
term = TerminHTML.from_commands(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/main.py", line 59, in from_commands
command_results = _run_commands_create_command_results(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/main.py", line 137, in _run_commands_create_command_results
return run_commands(
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 96, in run_commands
out_command = run(command, last_context, input=this_command_input)
File "/home/pawamoy/.local/pipx/.cache/78b42e3944fa77f/lib/python3.10/site-packages/terminhtml/runner/main.py", line 56, in run
raise UserCommandException(
terminhtml.exc.UserCommandException: Command failed: make format due to Command had non-zero exit code as part of running commands=['make format'] setup_command='' input=None
context=cwd=PosixPath('.') env=None
output:
make: *** No rule to make target 'format'. Stop.
Wow, this is a really nice project!
I've used and tried many command line SVG recorder/renderers, and this one is definitely the easiest to use, by far.
It deserves many more views and stars โญ !
I'll probably open a few issues next ๐
enable ANSI formatting for prompts
Right now we are just stripping ANSI formatting from prompts, as the prompt gets stored in
a data attribute of the element. terminhtmljs will need to be updated to support
a way of providing an HTML structure for prompts.
return _output_span_element(
ansi_to_html(line),
self.delay,
# TODO: enable ANSI formatting for prompts
# Right now we are just stripping ANSI formatting from prompts, as the prompt gets stored in
# a data attribute of the <span> element. terminhtmljs will need to be updated to support
# a way of providing an HTML structure for prompts.
strip_all_ansi(self.prompt_output.prompt) if self.prompt_output else None,
line_ending=self.line_ending,
)
f0d3cb2be680f7eb7ee47869002bf1a391ae63b6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.