Render source code into a PNG image.
Build the binary:
go build -o bin/gophershot ./cmd/gophershotUsing the built binary:
./bin/gophershot --out example/go-example.png internal/app/run.gorunParsed section example (lines 55:89, no transforms):
./bin/gophershot --out example/go-example.png --transform= --lines 55:89 internal/app/run.goTerraform file:
./bin/gophershot --out example/tf-example.png example/main.tfFrom stdin:
cat internal/app/run.go | ./bin/gophershot --out example/go-example.pngGo example:
Terraform example:
./bin/gophershot \
--out example/go-example.png \
--transform stripimports,errcompact \
--lines 15:40,44,48:52 \
--line-numbers=true \
--font-size 16 \
internal/app/run.go--out <path>: output PNG path (required)--lines <selector>: comma-separated segments, each segment is a line (7) or range (5:9); if repeated, the last value is used--transform <names>: comma-separated names, applied in order; if repeated, the last value is used; when omitted defaults are language-aware (stripimports,errcompactfor Go/stdin, none for.tf)--line-numbers[=true|false]: show line numbers (default:true)--font-size <float>: code font size in points, must be> 0(default:16)-h,--help: show help
stripimports: removesimportdeclarationserrcompact: compactsif err != nil { ... }blocks into a single placeholder line
- Transforms run on the full file first.
- Line selection is applied after transforms, using original source line origins.
- Built-in transforms are Go-oriented; when input is
.tf, omitted--transformdefaults to no transforms. - Flags must be provided before the input path.
Run tests:
go test ./...- Project license: see repository license file.
- Third-party notices:
THIRD_PARTY_NOTICES.md - JetBrains Mono OFL text:
third_party/jetbrainsmono/OFL.txt

