termshot

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2020 License: MIT

README

termshot

License Go Report Card Build Status Codecov PkgGoDev Release

The termshot tool creates an image that resembles a user interface window similar to what Carbon, Instacode, or codekeep.io/screenshot do for code. However, it works completely offline and takes its input directly from a terminal command output. The ANSI escape codes for Select Graphic Rendition are used for text emphasis (bold, italic, and underline) and of course for terminal colors. Like time, watch, or perf, just place termshot before the command.

For example, create a screenshot of the command execution of dyff, which relies heavily on terminal colors for text highlighting:

$ termshot dyff between https://raw.githubusercontent.com/cloudfoundry/cf-deployment/v1.10.0/cf-deployment.yml https://raw.githubusercontent.com/cloudfoundry/cf-deployment/v1.20.0/cf-deployment.yml
     _        __  __
   _| |_   _ / _|/ _|  between https://raw.githubusercontent.com/cloudfoundry/cf-deployment/v1.10.0/cf-deployment.yml
 / _' | | | | |_| |_       and https://raw.githubusercontent.com/cloudfoundry/cf-deployment/v1.20.0/cf-deployment.yml
| (_| | |_| |  _|  _|
 \__,_|\__, |_| |_|   returned 80 differences
        |___/

manifest_version
  ± value change
    - v1.10.0
    + v1.20.0

instance_groups.database.jobs.mysql.properties.cf_mysql.mysql.port
  ± value change
    - 33306
    + 13306

[...]

This will create a (fake) screenshot which looks like this: example

Please note: This project is work in progress. Although a lot of the ANSI sequences can be parsed, there are definitely commands in existence that create output that cannot be parsed correctly, yet. Also, commands that reset the cursor position are known to create issues.

Directories

Path Synopsis
cmd
internal
cmd
img

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL