Git Product home page Git Product logo

termshot's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar github-actions[bot] avatar heavywombat avatar prabhat-kumar avatar qu1queee avatar rothgar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

termshot's Issues

Fails with an error on Linux systems

On Linux systems, termshot fails with an IO error:

╭ Error occurred
│ read /dev/ptmx: input/output error
╵

Based on creack/pty#100, this happens because io.Copy() is reading until io.EOF. However, if the child process is already done it can happen on a Linux system that the parent process is still trying to read.

Multiple commands in one screenshot?

would be useful to me to be able to specify a series of commands, and see each command/output in sequence in the screenshot

would this be feasible to add? could you direct me to the relevant parts of the code?

Moving cursor left by 500 crashes termshot

Seems like this is an issue with bunt.. I'll report it there too.

panic: strconv.ParseUint: parsing "500": value out of range

goroutine 1 [running]:
github.com/gonvenience/bunt.ParseStream.func3({0xc00020c0d0?, 0x0?})
        github.com/gonvenience/[email protected]/parse.go:112 +0x48
github.com/gonvenience/bunt.ParseStream.func4()
        github.com/gonvenience/[email protected]/parse.go:142 +0x148
github.com/gonvenience/bunt.ParseStream({0x6ce1a8?, 0xc0000f6bd0?}, {0x0, 0x0, 0xc000224000?})
        github.com/gonvenience/[email protected]/parse.go:225 +0x4e2
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0xc000687bd0, {0x6ce1a8?, 0xc0000f6bd0?})
        github.com/homeport/termshot/internal/img/output.go:116 +0x39
github.com/homeport/termshot/internal/cmd.glob..func1(0x960900?, {0xc0000f6b70?, 0x1, 0x3})
        github.com/homeport/termshot/internal/cmd/root.go:115 +0x4d0
github.com/spf13/cobra.(*Command).execute(0x960900, {0xc000010090, 0x3, 0x3})
        github.com/spf13/[email protected]/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x960900)
        github.com/spf13/[email protected]/command.go:1040 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:968
github.com/homeport/termshot/internal/cmd.Execute()
        github.com/homeport/termshot/internal/cmd/root.go:144 +0x67
main.main()
        ./main.go:26 +0x17

panic: reached end of file before reaching end identifier

I'm trying to use termshot to capture Nushell output, and it panics.

./result/bin/termshot nuls
╭────┬────────────────────────┬─────────┬────────┬───────────────╮
│  # │          name          │  type   │  size  │   modified    │
├────┼────────────────────────┼─────────┼────────┼───────────────┤
│  0 │ CONTRIBUTING.md        │ file    │ 8.4 KB │ 8 hours ago   │
│  1 │ COPYING                │ file    │ 1.1 KB │ 8 hours ago   │
│  2 │ README.md              │ file    │ 6.2 KB │ 2 months ago  │
│  3 │ default.nix            │ file    │  971 B │ a year ago    │
│  4 │ doc                    │ dir     │   23 B │ 8 hours ago   │
│  5 │ flake.nix              │ file    │ 2.3 KB │ 2 months ago  │
│  6 │ lib                    │ dir     │   34 B │ 8 hours ago   │
│  7 │ maintainers            │ dir     │    5 B │ 8 hours ago   │
│  8 │ nixos                  │ dir     │   13 B │ 8 hours ago   │
│  9 │ pkgs                   │ dir     │   18 B │ a year ago    │
│ 10 │ result                 │ symlink │   58 B │ 5 minutes ago │
│ 11 │ update-git-commits.txt │ file    │  740 B │ 2 months ago  │
╰────┴────────────────────────┴─────────┴────────┴───────────────╯exit
panic: reached end of file before reaching end identifier

goroutine 1 [running]:
github.com/gonvenience/bunt.ParseStream.func2(0x7)
	github.com/gonvenience/[email protected]/parse.go:100 +0x88
github.com/gonvenience/bunt.ParseStream.func4()
	github.com/gonvenience/[email protected]/parse.go:172 +0xb8
github.com/gonvenience/bunt.ParseStream({0x6db758?, 0xc00018eb70?}, {0x0, 0x0, 0xc0001e7000?})
	github.com/gonvenience/[email protected]/parse.go:225 +0x4ed
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0xc000181bd0, {0x6db758?, 0xc00018eb70?})
	github.com/homeport/termshot/internal/img/output.go:116 +0x39
github.com/homeport/termshot/internal/cmd.glob..func1(0x9778e0?, {0xc0000b33d0?, 0x1, 0x1})
	github.com/homeport/termshot/internal/cmd/root.go:115 +0x4d0
github.com/spf13/cobra.(*Command).execute(0x9778e0, {0xc000016050, 0x1, 0x1})
	github.com/spf13/[email protected]/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x9778e0)
	github.com/spf13/[email protected]/command.go:1040 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:968
github.com/homeport/termshot/internal/cmd.Execute()
	github.com/homeport/termshot/internal/cmd/root.go:144 +0x67
main.main()
	github.com/homeport/termshot/cmd/termshot/main.go:26 +0x17

This is with v0.2.5 of termshot.

Font selection

Add an option to select the desired font.

Description

As far as I can tell, the font is hardcoded to "Hack", which does not support all of unicode.
The user should be able to select a font on their system, so as to use whatever patched font they fancy.

This would probably fix both #1 and #60

Support for taking stdin or using termshot as a pipe

I'm not too sure if this is possible, though given the following sequence of commands, I think it should be possible code-wise?

Screenshot 2023-11-21 at 02 44 56

Naturally, if I attempt to use - as the command or simply nothing, it just errors, though, given the fact it's still able to take stdin as a command, and correctly produce a screenshot, when provided with any valid executable, seems to point to it just being an error handling thing.

If you can point me to where in the code this kind of thing is handled, I'm more than happy to impl it myself and open a pull request :)

Termshot does not preserve colors

Idea:

This might be a no-op, quickly adding this for now.

When I do a git status and git highlights in RED new files, that color is not preserved if I do a termshot -i "git status"

Make output filename configurable

The generated output filename is fixed at the moment and the file will be overwritten if it exists already. Add code to make the name configurable via a command line flag.

Acceptance Criteria: Be able to specify a filename using the CLI, for example:

termshot --output termshot.png -- uptime

Feature: Light mode

Would be nice to have a light mode when generating the image.

Use case is that our CLI program has both a dark and light mode, and we would like to preview both using termshot.

Mockup of how I envision it (super simple):

example


Edit: Sorry, just realized that this is a potential duplicate of #80

Frozen terminal when using `--edit` using last release (0.2.7) in Arch Linux.

Thanks 4 termshot because till today, I just did enlarge the font a lot and did the best screenshot I could to share it with someone.

Works good when doing basic CLI screenshot:

$ termshot --show-cmd -- ls -1

But adding --edit command, editor show content, but stay frozen:

$ termshot --edit --show-cmd -- ls -1

I did try changing editor (vis, nano, busybox vi) with same result:
$ EDITOR=nano termshot --edit --show-cmd -- ls -1 ~/.config/mpv

This is the frozen output (ls -1 ~/.config/mpv):

^[[38;2;0;255;0m...^[[0m ^[[38;2;105;105
input.conf^M
mpv.conf^M
scripts^M
shaders^M
~
~
~
~
~
bad option: number

Then I had to open another terminal to unfrozen it (by killing): pkill termshot

I did try with two terminals, with | without multiplexer, but happens the same:

  • xterm
  • kitty
  • st
  • tmux

I did use:

  • Last binary from: releases
  • Also: brew install homeport/tap/termshot from README.md

Maybe it's the same and will work if I do compilation by myself with last GIT. I'm no programmer and just do AUR compilations, if I get a minimal problem, I'm not able to fix it.

  • But seems strange, that no one else did the Issue.
  • What am I doing wrong?

Software versions:

$ termshot -v
termshot version 0.2.7

$ xterm -v
XTerm(390)

$ st -v
st 0.9

$ kitty -v
kitty 0.31.0 created by Kovid Goyal

$ neofetch distro kernel
distro: Arch Linux x86_64
kernel: 6.1.52-1-lts

way to influence image file size

@HeavyWombat suggested looking at termshot in homeport/dyff#264, and I tried running it with the commands I used there. The output is gorgeous, but quite large: The MacOS screenshot was a 30k PNG, and the termshot one was 134k. That's probably just the resolution difference: termshot gave me a 2051 x 1462 image, while I grabbed a 443 x 308 image with the screenshot. termshot seems more efficient per pixel, but maybe an option to reduce the resolution would be handy.

Content width is exceeding the rounded rectangle x axis

Issue description:

I'm using latest termshot to generate an image based on an ls cmd. I can see that the stdout of my cmd is not fitting into the rounded rectangle but it actually exceeds it(in other words, the list of files and directories is incomplete in the generated image). I unfortunately was not able to understand why, any ideas?

Would be good if you can reproduce this from your side.

Add `--output` flag

Hi, great work,

Have you consider adding an --output flag so the filename is not defaulting to out.png

Add highlight flag

Idea: Add a flag to configure text that is later highlighted in the output. It could be encircled with a red oval, or some kind or arrow is used, or simply text color is added. Options could include from highlighting only piece of text or the entire line.

`panic: move cursor value is out of bounds` after any command with ANSI escape sequences

I get the following panic when trying to use termshot -- pfetch and termshot -- "./simple-go-cli-program", the latter just prints plain text, it's a tiny go program I wrote to test.

I think this has to do with color handling in my terminal? Though, I'm not sure why my Go program (only using log.Printf) would have any color escapes in the output.

panic: move cursor value is out of bounds

goroutine 1 [running]:
github.com/gonvenience/bunt.ParseStream.func4()
	github.com/gonvenience/[email protected]/parse.go:144 +0x1a8
github.com/gonvenience/bunt.ParseStream({0x102456738?, 0x1400016ac00?}, {0x0, 0x0, 0x1400033f000?})
	github.com/gonvenience/[email protected]/parse.go:225 +0x3b0
github.com/homeport/termshot/internal/img.(*Scaffold).AddContent(0x14000123bb8, {0x102456738?, 0x1400016ac00?})
	github.com/homeport/termshot/internal/img/output.go:118 +0x3c
github.com/homeport/termshot/internal/cmd.glob..func1(0x1026eca80?, {0x1400016aba0?, 0x1, 0x3})
	github.com/homeport/termshot/internal/cmd/root.go:120 +0x39c
github.com/spf13/cobra.(*Command).execute(0x1026eca80, {0x14000132050, 0x3, 0x3})
	github.com/spf13/[email protected]/command.go:940 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x1026eca80)
	github.com/spf13/[email protected]/command.go:1068 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:992
github.com/homeport/termshot/internal/cmd.Execute()
	github.com/homeport/termshot/internal/cmd/root.go:162 +0x64
main.main()
	./main.go:26 +0x1c

Using the following answer from StackoverFlow with pfetch does indeed work as expected, though without and color or formatting.

Terminal info:
out

If there's any other info I can help provide, please let me know.

How to save contents to clipboard instead of path

Is it possible to save the contents of your termshot to clipboard instead of file?

I'm using MacOS Ventura which has pbcopy/pbpaste. Would it work if you can pass the output to STOUT?

Command would look something like
termshot --<COMMAND FOR CLIPBOARD> --- ls .

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.