Git Product home page Git Product logo

terminhtml's People

Contributors

github-actions[bot] avatar nickderobertis avatar semantic-release-bot avatar

Stargazers

 avatar  avatar

Watchers

 avatar

terminhtml's Issues

Different behavior between -c and --cwd

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
Full traceback (click to expand)
% 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 dot as current working directory fails

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.

Full traceback (click to expand)
% 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.

Amazing project

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

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.

# TODO: enable ANSI formatting 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.