A small CLI for generating QR codes as PNG files, with optional console preview.
Install the latest release:
curl -fsSL https://raw.githubusercontent.com/orashus/qrcgen/main/install.sh | bashInstall a specific version:
curl -fsSL https://raw.githubusercontent.com/orashus/qrcgen/main/install.sh | bash -s -- v1.0.0Install to a custom directory:
INSTALL_DIR="$HOME/.local/bin" curl -fsSL https://raw.githubusercontent.com/orashus/qrcgen/main/install.sh | bashSupported platforms: Linux and macOS on amd64 and arm64.
go install github.com/orashus/qrcgen@latestRequires Go, and $GOPATH/bin (or $HOME/go/bin) on your PATH.
git clone https://github.com/orashus/qrcgen.git
cd qrcgen
go build -o qrcgen .Build with an explicit version:
go build -ldflags "-s -w -X main.version=v1.0.0" -o qrcgen .qrcgen <text> [output file] [flags]Examples:
# Generate qrcode.png from a URL
qrcgen https://example.com
# Write to a custom filename
qrcgen https://example.com my-qr
# Print the QR code to the terminal as well
qrcgen -p https://example.com my-qr
qrcgen https://example.com my-qr -p
# Check the installed version
qrcgen --versionFlags:
-p,--print— print the QR code to the console-v,--version— print the installed version
If no output file is provided, the PNG is written to qrcode.png. Output names without a .png suffix get one added automatically.
Releases are published automatically when a version tag is pushed:
git tag v1.0.0
git push origin v1.0.0Each release includes binaries for:
qrcgen-linux-amd64qrcgen-linux-arm64qrcgen-darwin-amd64qrcgen-darwin-arm64qrcgen-windows-amd64.exe
Release builds inject the git tag into the binary, so qrcgen --version reports the tag that was built (for example, v1.0.0). Local builds from source report dev unless a version is passed via -ldflags.