Giter Club home page Giter Club logo

freeze's Introduction

Freeze


Latest Release Build Status

Generate images of code and terminal output.

Freeze code screenshot

Examples

Freeze generates PNGs, SVGs, and WebPs of code and terminal output alike.

Generate an image of code

freeze artichoke.hs -o artichoke.png

output of freeze command, Haskell code block

Generate an image of terminal output

You can use freeze to capture ANSI output of a terminal command with the --execute flag.

freeze --execute "eza -lah"

output of freeze command, ANSI

Freeze is also super customizable and ships with an interactive TUI.

Installation

# macOS or Linux
brew install charmbracelet/tap/freeze

# Arch Linux (btw)
yay -S freeze

# Nix
nix-env -iA nixpkgs.charm-freeze

Or, download it:

  • Packages are available in Debian and RPM formats
  • Binaries are available for Linux, macOS, and Windows

Or, just install it with go:

go install github.com/charmbracelet/freeze@latest

Customization

Interactive mode

Freeze features a fully interactive mode for easy customization.

freeze --interactive

freeze interactive mode

Settings are written to $XDG_CONFIG/freeze/user.json and can be accessed with freeze --config user.

Flags

Screenshots can be customized with --flags or Configuration files.

Note

You can view all freeze customization with freeze --help.

Language

If possible, freeze auto-detects the language from the file name or analyzing the file contents. Override this inference with the --language flag.

cat artichoke.hs | freeze --language haskell

output of freeze command, Haskell code block

Theme

Change the color theme.

freeze artichoke.hs --theme dracula

output of freeze command, Haskell code block with dracula theme

Output

Change the output file location, defaults to out.svg or stdout if piped. This value supports .svg, .png, .webp.

freeze main.go --output out.svg
freeze main.go --output out.png
freeze main.go --output out.webp

# or all of the above
freeze main.go --output out.{svg,png,webp}

Font

Specify the font family, font size, and font line height of the output image. Defaults to JetBrains Mono, 14(px), 1.2(em).

freeze artichoke.hs \
  --font.family "SF Mono" \
  --font.size 16 \
  --line-height 1.4

You can also embed a font file (in TTF, WOFF, or WOFF2 format) using the --font.file flag.

To use ligatures in the font, you can apply the --font.ligatures flag.

Line Numbers

Show line numbers in the terminal window with the --show-line-numbers flag.

freeze artichoke.hs --show-line-numbers

To capture only a specific range of line numbers you can use the --lines flag.

freeze artichoke.hs --show-line-numbers --lines 2,3

Border Radius

Add rounded corners to the terminal.

freeze artichoke.hs --border.radius 8

code screenshot with corner radius of 8px

Window

Add window controls to the terminal, macOS-style.

freeze artichoke.hs --window
output of freeze command, Haskell code block with window controls applied

Background

Set the background color of the terminal window.

freeze artichoke.hs --background "#08163f"

Height

Set the height of the terminal window.

freeze artichoke.hs --height 400

Border Width

Add a border outline to the terminal window.

freeze artichoke.hs --border.width 1 --border.color "#515151" --border.radius 8

output of freeze command, Haskell code block with border applied

Padding

Add padding to the terminal window. You can provide 1, 2, or 4 values.

freeze main.go --padding 20          # all sides
freeze main.go --padding 20,40       # vertical, horizontal
freeze main.go --padding 20,60,20,40 # top, right, bottom, left

output of freeze command, Haskell code block with padding applied

Margin

Add margin to the terminal window. You can provide 1, 2, or 4 values.

freeze main.go --margin 20          # all sides
freeze main.go --margin 20,40       # vertical, horizontal
freeze main.go --margin 20,60,20,40 # top, right, bottom, left

output of freeze command, Haskell code block with margin applied

Shadow

Add a shadow under the terminal window.

freeze artichoke.hs --shadow.blur 20 --shadow.x 0 --shadow.y 10

output of freeze command, Haskell code block with a shadow

Screenshot TUIs

Use tmux capture-pane to generate screenshots of TUIs.

Run your TUI in tmux and get it to the state you want to capture. Next, use capture-pane to capture the pane and pipe that to freeze.

hx # in a separate pane
tmux capture-pane -pet 1 | freeze -c full

helix captured with freeze

Configuration

Freeze also supports configuration via a JSON file which can be passed with the --config / -c flag. In general, all --flag options map directly to keys and values in the config file

There are also some default configurations built into freeze which can be passed by name.

  • base: Simple screenshot of code.
  • full: macOS-like screenshot.
  • user: Uses ~/.config/freeze/user.json.

If you use --interactive mode, a configuration file will be created for you at ~/.config/freeze/user.json. This will be the default configuration file used in your screenshots.

freeze -c base main.go
freeze -c full main.go
freeze -c user main.go # alias for ~/.config/freeze/user.json
freeze -c ./custom.json main.go

Here's what an example configuration looks like:

{
  "window": false,
  "border": {
    "radius": 0,
    "width": 0,
    "color": "#515151"
  },
  "shadow": false,
  "padding": [20, 40, 20, 20],
  "margin": "0",
  "font": {
    "family": "JetBrains Mono",
    "size": 14
  },
  "line_height": 1.2
}

Feedback

We’d love to hear your thoughts on this project. Feel free to drop us a note!

License

MIT


Part of Charm.

The Charm logo

Charm热爱开源 • Charm loves open source

freeze's People

Contributors

aymanbagabas avatar caarlos0 avatar ccoveille avatar codezea1ot avatar gaogao-qwq avatar isabelroses avatar maaslalani avatar meowgorithm avatar tymekdev 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  avatar

freeze's Issues

Support bold in ANSI coloring

Is your feature request related to a problem? Please describe.
Want bold styling to show in the images.

Describe the solution you'd like
Just enabling simple bold styling on the text, as you have commented-out in ansi.go:

freeze/ansi.go

Lines 140 to 142 in 80803eb

case 1:
// span.CreateAttr("font-weight", "bold")
p.lines[p.row].AddChild(span)

Why is that commented out?

Describe alternatives you've considered
I have tried cloning the repo, uncommenting that line, and it seems to work just fine. Not a super nice workflow though.

Additional context

feat: print line numbers

It would be great have the option to include line numbers, as I'm often using screenshots to walk through a file one chunk at a time. If they're following along with the code open on their machine, I want it to be easy for them to follow along.

Command execution output is misaligned

Describe the bug
When running commands that produce columnar output the alignment can be off

To Reproduce
Steps to reproduce the behavior:

  1. freeze -x 'tokei usds_linux_base' -o linuxbase.png
  2. See misaligned output

Expected behavior
I would expect the output to be lined up like the native commands output.

Screenshots
image

Desktop (please complete the following information):

  • OS: Mac
  • Version 14.3.1
  • Kitty terminal 0.33

feat: include confirmation dialogue if a file is about to get overwritten

The confirmation dialogue we have in huh would be great to include before writing to a file if that file already exists in the current dir.

If the user chooses not to overwrite the file, maybe have a text input pop up for them to choose a new file name, or ask them to re-run the command with an output set (although I think the former is a better UX)

Piped content boundaries are not correct

Describe the bug
The text extends beyond the borders of the image.

To Reproduce

config.go
package config

import (
	"fmt"
	"os"
	"reflect"
	"strconv"
	"strings"
)

type Config struct {
	Telegram struct {
		Token   string `env:"TG_TOKEN"`
		ChatID  string `env:"TG_CHAT"`
		OwnerID string `env:"TG_ADMIN"`
	}

	Database struct {
		DSN string `env:"DB_DSN"`
	}

	Log struct {
		Level string `env:"LOG_LEVEL"`
	}

	Debug bool
}

func Load() (*Config, error) {
	var c Config
	err := parseStruct(&c, "")
	if err != nil {
		return nil, err
	}
	return &c, nil
}

cat config.go | freeze --language go --theme murphy

Expected behavior
I expect the image to be a little wider so that the data inside the tags will fit completely into the image. And also the colored background of the symbols will be in correct place.

Screenshots

Resulted image

screenshot

Desktop (please complete the following information):

  • macOS 14.4
  • iTerm 3.5.0beta17

Interactive mode for `--execute`

Right now using --execute and --interactive together overrides --execute and starts the flow for creating an image from a file. It would be awesome if freeze would present interactive settings for --execute mode instead.

feat: plot the command along with the result

Thanks for developing this great tool.

Is your feature request related to a problem? Please describe.
Nope

Describe the solution you'd like
It would be great if the command could be plotted optionally with one flag.

E.g.,

freeze -x "seq 3"  -o t.png --include-cmd

generates a "figure" below.

$ seq 3
1
2
3

Describe alternatives you've considered

Nope

Additional context

Nope

feat(ux): include feedback to show that it was successful ?

When I gave an invalid field in my custom config file, there was no feedback in the terminal, but also no file produced. Would be great to provide a bit more feedback like "exported as myfile.png" in green text or something? That way if there are edge cases that get missed, the user can at least see that something wasn't quite right without looking for the file

`freeze --version`

Can --version flag be added to the freeze command, to allow for better dependency checks and installation?

feat: add option to change default file output

When I'm using freeze for b-roll footage it has to be a png since many video editors don't accept svg file formats for graphics. To do this in freeze, I need to use the -o flag and specify the file name with a .png extension and that works fine. Would be great to be able to specify this in my config file though

Bug when capturing colored output

Describe the bug
I wrote logger handler for slog using lipgloss and in terminal all going well but in screenshoot all messsedup

To Reproduce
Just use --execute with program that used lipgloss

Expected behavior
On screenshot

Screenshots
Expected:
image

Output:
freeze

Desktop (please complete the following information):

  • OS: MacOS 14.4
  • Browser Chrome(Arc)
  • Version 1.38

Missing Documentation for Customization

Describe the bug
The Customization section of the README.md has not been updated to reflect the latest output of freeze -h.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Customization section of the README.md
  2. Take note of the options that are listed
  3. Open a shell session and run freeze -h
  4. Note how there are options in the help menu that are not mentioned in the README.md Customization section

Expected behavior
All customization options are documented in the README.md file so users know they are available without having to first download freeze to run the --help option to find them.

Screenshots
Screenshot 2024-04-18 132052

Desktop (please complete the following information):

  • Windows 11 running WSL 2 | Ubuntu 22.04.3 LTS
  • freeze v0.1.6

docs: configuration improvements

After playing with custom styles a bit, it feels like there are some spots where we could be more explicit in the documentation.

  • Tell users where the default configuration file can live, so they don't need to use -c myconfig.json flag every time they want to use their template. This isn't stated explicitly
  • Mention that all of the flags in the help command can be included in your config file or mention that the example provided gives you all of the available options to configure.
  • Mention the config file as a customization option when it's first mentioned

feat: set width and height

it would be great to be able to set the width and make the content wrap. That would make the images look more consistent. If the content exceeds the height, it can be clipped

Lines from:to and filename in window frame. Maybe line numbers

Is your feature request related to a problem? Please describe.
I want to integrate this app to my IDE/ NVIM and visualy choose which lines of code i want to share. Then copy to clipboard and send it via some messeneger. And it will be nice if reciever will see filename so he can know where to search

Describe the solution you'd like
I need some configuration flags for this options

something like(we can make window title just a string and just pass it):

freeze --line.from=10 --line.to=20 --window.filename = true --numbers=true

Describe alternatives you've considered
I considered to copy lines to temporary file and then process this temporary file with this app. But it will ruin line numbers and filename/path

missing line numbering from default configuration file

I don't speak English. This is an automatic translation from Google.

I created a default configuration file by running the program interactively, however when I changed the value of the "lines_numbers" parameter the line numbering was missing, but I fixed it by changing the parameter name to "show_line_numbers". I think the problem is that this parameter is named incorrectly, and I hope this gets fixed soon.

bug: `freeze --execute` outputs "unsupported" [Windows]

When I execute freeze --execute "dir" or any command aside from dir I get

ERROR: Something went wrong
unsupported

if --execute isn't supported on windows an explicit disclaimer would be nice

image

  • OS: Microsoft Windows 11 Pro
  • Version: 10.0.22631 N/A Build 22631

feat: change default file name for exports

If I forget to specify an output name, it always defaults to out.svg. This can cause me to accidentally overwrite files. It would be awesome if instead it matched the file name that we're capturing. If there is already a file with that name, add a number.

e.g.
freeze super-important.sh
outputs
super-important.svg and if that exists already, then it's super-important_1.svg

`--execute` hangs indefinitely with TUIs

So something like freeze -x "man cat" will hang forever because it opens less and sits in the altscreen waiting for the user to exit.

One solution could be to set a timeout, possibly even one that could be specified

freeze --execute "man cat" --timeout 5

Otherwise, I think it's fine not to support this, but we should document the limitation.

Add -v flag to get the version of binary

Is your feature request related to a problem? Please describe.
Nop, just to be as all your other tools, I would like to get the binary version with the -v flag.

Describe the solution you'd like
"freeze -v" command should print the version of the binary

Thanks for all the wonderful tools

Support Multi-Language highlighting

Is your feature request related to a problem? Please describe.
In my day to day, I write a lot of dbt code which leverages a lot of jinja-sql (e.g. Jinja syntax in conjunction with SQL).

freeze can highlight those either as SQL or Jinja, but not as both (the Jinja code as Jinja and the SQL code as SQL, at the same time)

Describe the solution you'd like
It looks like chroma supports this type of multi-language highlighting already, when we define both a language and a root.

freeze could be updated to add an argument for a second language, or like the Jinja VSCode extension does, provide new languages, like jinja-sql

Describe alternatives you've considered
Not getting both languages highlighting and doing screenshots in VSCode

Additional context
N/A

put result in clipboard

Is your feature request related to a problem? Please describe.
I like to take snippet of code and paste image into chat or twitter directly,.

Describe the solution you'd like
freeze --clipboard mycode.java or similar to then just be able to paste result without intermediate files

png: rsvg-convert implementation

There is something strange to me with current code

freeze/png.go

Lines 14 to 31 in 4fcacff

func libsvgConvert(doc *etree.Document, w, h float64, output string) error {
_, err := exec.LookPath("rsvg-convert")
if err != nil {
return err
}
svg, err := doc.WriteToBytes()
if err != nil {
return err
}
// rsvg-convert is installed use that to convert the SVG to PNG,
// since it is faster.
rsvgConvert := exec.Command("rsvg-convert", "-o", output)
rsvgConvert.Stdin = bytes.NewReader(svg)
err = rsvgConvert.Run()
return err
}

You are not using w and h variables.

So either, you should simplify the signature, or use them as parameter for rsvg-convert

as it supports it

USAGE:
    rsvg-convert [FLAGS] [OPTIONS] [FILE]...

FLAGS:
    -?, --help                  Prints help information
    -a, --keep-aspect-ratio     Preserve the aspect ratio
        --keep-image-data       Keep image data
        --no-keep-image-data    Do not keep image data
    -u, --unlimited             Allow huge SVG files
    -v, --version               Prints version information

OPTIONS:
    -l, --accept-language <languages>    Languages to accept, for example "es-MX,de,en" [default uses language from the
                                         environment]
    -b, --background-color <color>       Set the background color using a CSS color spec
    -i, --export-id <object id>          SVG id of object to export [default is to export all objects]
    -f, --format <format>                Output format [default: png]  [possible values: Png, Pdf, Ps, Eps, Svg]
        --left <length>                  Distance between left edge of page and the image [defaults to 0]
    -o, --output <output>                Output filename [defaults to stdout]
        --page-height <length>           Height of output media [defaults to the height of the SVG]
        --page-width <length>            Width of output media [defaults to the width of the SVG]
    -d, --dpi-x <number>                 Pixels per inch [default: 96]
    -p, --dpi-y <number>                 Pixels per inch [default: 96]
    -w, --width <length>                 Width [defaults to the width of the SVG]
    -h, --height <length>                Height [defaults to the height of the SVG]
    -s, --stylesheet <filename.css>      Filename of CSS stylesheet to apply
        --top <length>                   Distance between top edge of page and the image [defaults to 0]
    -z, --zoom <number>                  Zoom factor
    -x, --x-zoom <number>                Horizontal zoom factor
    -y, --y-zoom <number>                Vertical zoom factor

So the code would be something like this

	rsvgConvert := exec.Command("rsvg-convert", "-o", output, "-w", fmt.Sprintf("%.0f", w), "-h", fmt.Sprintf("%.0f", w))

Freeze is not available in the Arch Repository

no

Hi Just saw the twitter post and I really felt like its the tool I need every day. While I was installing I found out that it looks like Freeze is not yet downloadable on Arch Linux via Pacman, but yet it is mentioned in the README. Is it really not up in the Arch Repository or am I missing something ?

Tho, I've downloaded the Binary!

Thank You

`freeze --publish`

It would be nice to be able to publish images to Ghost, similar to what we do with vhs --publish

$ freeze idk.hs --publish
Published!
https://freeze.charm.sh/freeze-5dAYgQBpFY7DA6poeHNNDJ.png

refactor: make `--lines` inclusive

The current usage would be freeze --lines 3,5 file.sh if we wanted rows 3 and 4 included in the screenshot. I think it would be more intuitive to make the range inclusive of the upper bound instead of exclusive as it is currently. New usage would be freeze --lines 3,4 file.sh to capture lines 3 and 4

Document available themes

Describe the bug
You mention that you support themes in the README, but the only thing you view is the following:

Change the color theme.

freeze artichoke.hs --theme dracula

Never in the docs or the code base can I see which themes you support.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/charmbracelet/freeze?tab=readme-ov-file#theme
  2. Look around the codebase
  3. Sadface

Expected behavior
After looking at your dependencies, I could quite quickly see that you're using chroma.

Chroma does link to a page where you can view themes, so it'd be nice to have the same link here in the freeze docs: https://xyproto.github.io/splash/docs/index.html

You also add the "charm" specific theme, which is not included in that page. So maybe something like:

As we use chroma, you can use any of the themes found in https://github.com/alecthomas/chroma/tree/master/styles.
Previews of chroma's themes: https://xyproto.github.io/splash/docs/index.html

We also add in an additional charm theme

Screenshots
N/A

Desktop (please complete the following information):

  • OS: linux
  • Browser firefox
  • Version 124.0.1

Smartphone (please complete the following information):
N/A

Additional context
Nice tool you got here :) I really like it

`freeze --execute` doesn't work with pipes/redirects

Feature / Bug

I really like the --execute functionality of freeze but I am somewhat annoyed with the fact that I cannot execute commands with pipes or redirects. To provide a simple example, I created a file named file.txt with the contents:

bar1
foo1
bar2
foo2

cat file.txt | grep 'foo' will return:

foo1
foo2

freeze --execute "cat file.txt | grep 'foo'" will return:
freeze

It appears to stops parsing at the pipe and only executes cat file.txt. I checked shellwords.Parse(), which is called by pty.go, executeCommand(), and the behavior might stem from there.

I have no experience in Go so I can't be sure, but someone more knowledgeable than me might be able to verify. When I added test cases to check this in the parsing library, it appears to parse up until a pipe or redirect as expected. Apologies if my analysis is wrong, but in my cursory look at the code, that's what stood out to me.

Describe the solution you'd like

It would be nice if --execute would take any command and execute it to completion before creating the output image. Ideally, in the example above, that command should function identically and return the following image:
freeze

Describe alternatives you've considered

To get the above image, I used cat file.txt | grep 'foo' | freeze --language bash. This isn't too complex of an alternative, but has two immediate downsides:

  • It requires that the user pass a language.
  • It seems to go against the initial instinct to use --execute in the first place.

This also highlights that syntax highlighting will not work on --executed inputs. If I wanted to do something like freeze --execute "cat main.cpp", it would fail to properly highlight the syntax. I don't really think this is that problematic, but it is worthy of note. The --language flag will not fix this and will output the same image.

Additional context

I am using a non-standard freeze config but I can't imagine that's affecting anything in this case. I just like less padding & rounded corners on my images :)

Capturing error output

freeze currently aborts if there's an error during --execute. It could be helpful for users to be able to make images from error messages.

For example, it could be useful for sharing compiler errors:

"ERROR Unable to convert SVG to PNG" on short groovy file

Describe the bug
I was hoping for slightly improved syntax highlighting on a groovy file by specifying the language java. freeze exited with message ERROR Unable to convert SVG to PNG (exit code 1) when generating a PNG.

My experience is that one out of every 200 groovy files behaves this way.

user@shell$ freeze abapEnvironmentPushATCSystemConfig.groovy -l java -o /tmp/butts.png
thread '<unnamed>' panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:524:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

   ERROR  Unable to convert SVG to PNG

  wasm error: unreachable
  wasm stack trace:
      .$831()
      .$327(i32,i32,i32,i32,i32)
      .$839(i32)
      .$838(i32)
      .$168(i32)
      .$131(i32,i32)
      .$65()
      .$47(i32,i32,i32)
      .$909(i32,i32,i32)
      .$98(i32,i32)
      .$97(i32,i32)
      .$1626(i32,i32)

To Reproduce
Steps to reproduce the behavior:

  1. git clone https://github.com/SAP/jenkins-library.git
  2. cd jenkins-library/vars
  3. freeze abapEnvironmentPushATCSystemConfig.groovy -l java -o /tmp/x.png
  4. See error

Expected behavior
An SVG can be created without issue and visually looks correct, so freeze should be able to generate a png without error.

Screenshots
n/a

Desktop (please complete the following information):

  • OS: macOS Sonoma 14.3
  • Browser n/a
  • Version (no --version flag was apparent for freeze)

Smartphone (please complete the following information):
n/a

Additional context
Add any other context about the problem here.

Add the filename text to the generated image.

When generating images for multiple code files, I would like to mark the file names on the images so that the relationship between files can be clearer.

For example, it is possible to add "--filename CUSTOMIZATION" to generate an image with the file name in the middle of the top.

Currently I can only mark the file name through a picture editor.

Looking forward to your reply, thank you very much😊!

Snipaste_2024-04-30_13-11-48

`freeze -x` cutting content (svg & png files)

Hey, I was playing around with the -x flag and found a bug.

When I try and execute the lipgloss layout example without any extra configurations, the content gets cut off in unexpected ways

freeze.svg (created with freeze -x "go run ."
image

lipgloss-classic.png (created with freeze -x "go run ." -o "lipgloss-classic.png")
lipgloss-classic

bug: inconsistent border radius

ze command: sed -n 3,4p repo-summary.sh | freeze -w -r 10 -o gh-pr.png --language bash -o env-vars.png

ze result:
env-vars

as you can see, the right side of the image doesn't have the specified 10 pixel border radius to match the left

Images with shadow settings have a completely transparent background

Describe the bug
If I generate an image with any shadow options, the background becomes completely transparent. It happens regardless of other settings (window, no window, border radius, etc.)

To Reproduce
Steps to reproduce the behavior:

echo '# Hello' > test.md
freeze test.md -o test.md.png --shadow.blur 20 --shadow.x 10 --shadow.y 10

Expected behavior
An image of the markdown file with a drop shadow.

Actual behaviour
test md

Desktop (please complete the following information):

  • OS: linux
  • Browser: firefox
  • Version: v0.1.4 deb package

Happy to help debug!

Output blank png image when use custom font family in windows

Describe the bug

Output blank png image when use custom font family in windows

To Reproduce
Steps to reproduce the behavior:

  1. Execute freeze -x "echo Something" --font.family "Microsoft YaHei" -o freeze.png
  2. Execute explorer freeze.png

Expected behavior

Got an blank image.

Screenshots
If applicable, add screenshots to help explain your problem.
Snipaste_2024-04-17_20-49-36

Desktop (please complete the following information):

  • OS: Microsoft Windows
  • Browser chrome
  • Version 23H2 10.0.22635.3495

Additional context

Load the default fonts dir may help this

freeze/png.go

Lines 50 to 57 in 80803eb

err = fontdb.LoadFontData(font.JetBrainsMonoTTF)
if err != nil {
printErrorFatal("Unable to load font", err)
}
err = fontdb.LoadFontData(font.JetBrainsMonoNLTTF)
if err != nil {
printErrorFatal("Unable to load font", err)
}

fontdb.LoadFontsDir(OS_FONTS_DIR)

feat: filter content by line numbers

I typically need to create screenshots that only include specific lines of code. I'm indifferent to using head/tail or having a --lines flag. I do think this will be used quite heavily though.

Darkened greys when line-numbers enabled

Describe the bug
When running a freeze --execute "command" --show-line-numbers the greys appear darker.

To Reproduce
Steps to reproduce the behavior:

  1. Run freeze with line numbers freeze --execute "ls" --show-line-numbers
  2. Run freeze without line numbers freeze --execute "ls"
  3. Compare

Expected behavior
The greys would be the same.

Screenshots
with-line-nums
without-line-nums

talk a code snap from line to line

be able to export from line-to-line code

would be nice if it had an interactive way, but I can work on a solution that cut it from line to line as an option, my solution would be instead of passing the whole file, pip it through cut or select then give the output to freeze

cat src/index.ts | head -n 2 | tail -n +1 | freeze code.ts -o test.png --language javascript

This is what I do to do that mission, so it would be nice if we could do it within freeze auto

Some commands don't work in Windows

Describe the bug
The commands such as ls, dir, and many other Powershell commands such as Get-Clipboard search for an exectuable in $env:PATH or %PATH%. The following is the error thrown

exec: "ls": executable file not found in %PATH%

(Replace ls with any other Powershell command that produces an output)

Since it explicitly mentions %PATH% (instead of $env:PATH), I even tried the same command in cmd (I was using PowerShell 7 previously). I still got the same error.

To Reproduce
Steps to reproduce the behavior:

  1. Open Windows Terminal (with either Powershell or Command Prompt profile)
  2. Type freeze --execute "ls", freeze --execute "dir" or freeze --execute "<any powershell command>"
  3. You'll now see the error

Expected behavior
All the Windows-native or Powershell commands must work

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows 11 Version: 10.0.22631.3374

"Dynamic output" generates a giant image

Describe the bug
Commands that have a "dynamic output" generate a giant image containing all the "frames".

To Reproduce
In my case, I tried to generate an image with hyperfine, but the output was an image measuring 240273 x 668px.

Expected behavior
Generate an image with the last command output.

Screenshots
I'm not going to attach the generating image because it's too big, and it's impossible to see anything without a lot of zoom.

Desktop

  • OS: Fedora 40 (kernel 6.8.2)
  • DE: KDE Plasma 6

RPM name collision on Fedora / Enterprise Linux

There is a name collision in the default repo for Fedora / Enterprise Linux with an older archive utility. Here is the output of dnf5 info freeze. Due to the version number it will want to upgrade a manually installed RPM to the other package.

Name           : freeze
Epoch          : 0
Version        : 0.1.4
Release        : 1
Architecture   : i386
Download size  : 4.6 MiB
Installed size : 11.1 MiB
Source         :
Repository     : charm
Summary        : Generate images of code and terminal output.
URL            :
License        :
Description    : Generate images of code and terminal output.
Vendor         : <NULL>

Name           : freeze
Epoch          : 0
Version        : 2.5.0
Release        : 36.fc39
Architecture   : x86_64
Download size  : 35.1 KiB
Installed size : 59.7 KiB
Source         : freeze-2.5.0-36.fc39.src.rpm
Repository     : fedora
Summary        : freeze/melt/fcat compression utilities
URL            :
License        : GPL+
Description    : Freeze is an old file compressor and decompressor that is not in
               : common use anymore, but can be useful if the need ever arises to
               : dearchive files compressed with it.
Vendor         : Fedora Project

For this to be more easily redistributable to a dev team, it might be nice to change the package name, perhaps something like freeze-charm? We certainly don't have (the older) freeze installed anywhere, but this collision means I would need to distribute it outside the standard channels, or rebuild/rename the RPM.

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.