ivcmd

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ivcmd contains the iv command.

Index

Constants

View Source
const DefaultEncoder = "rasterm"

DefaultEncoder is the encoder used when writing to a terminal.

Variables

View Source
var ErrNotKitty = errors.New("terminal does not use the kitty protocol")

ErrNotKitty is the error for --animate-mode kitty or stream on a terminal that does not use the Kitty protocol.

View Source
var ErrUnknownAnimateMode = errors.New("unknown animate mode")

ErrUnknownAnimateMode is the error for a value of --animate-mode that is not a mode.

Functions

func List

func List(w io.Writer) error

List writes the registered decoders and encoders to w.

Types

type Args

type Args struct {
	Verbose      bool          `ox:"enable verbose,short:v"`
	Quiet        bool          `ox:"enable quiet,short:q"`
	Mode         *ivctx.Mode   `ox:"scaling mode,short:m,default:best-fit"`
	Width        uint          `ox:"display width in pixels - 0 takes it from the terminal,short:W"`
	Height       uint          `ox:"display height in pixels - 0 takes it from the terminal,short:H"`
	MinWidth     uint          `ox:"minimum width in pixels,short:w,default:64,set:MinWidthSet"`
	MinHeight    uint          `ox:"minimum height in pixels,short:h,default:64,set:MinHeightSet"`
	DPI          uint          `ox:"image dpi,default:300,name:dpi"`
	Page         uint          `ox:"page to display,short:p"`
	Fg           *colors.Color `ox:"qr code foreground color,default:black"`
	Bg           *colors.Color `ox:"background color,default:transparent"`
	Border       uint          `ox:"qr code border width in pixels,default:40"`
	FontSize     uint          `ox:"font preview size,default:48"`
	FontWeight   uint          `ox:"font preview weight from 1 to 1000 - 0 is the weight of the face"`
	FontItalic   bool          `ox:"font preview in italic"`
	FontFg       *colors.Color `ox:"font preview foreground color,default:black"`
	FontBg       *colors.Color `ox:"font preview background color,default:white"`
	FontDPI      uint          `ox:"font preview dpi,default:100,name:font-dpi"`
	FontMargin   uint          `ox:"font preview margin,default:5"`
	TimeCode     time.Duration `ox:"video time code,short:t"`
	Animate      bool          `ox:"play the animation in an animated file,short:a"`
	Loop         bool          `ox:"repeat the animation until interrupted - implies --animate,short:l"`
	FPS          uint          `ox:"animation frames per second - 0 takes it from the animation,name:fps"`
	AnimateMode  string        `ox:"animation playback - auto/kitty/stream/frames - any but auto implies --animate,default:auto"`
	MermaidTheme string        `ox:"mermaid theme - default/dark/forest/neutral/modern"`
	MermaidBg    *colors.Color `ox:"mermaid background - the theme background when not set"`
	ZuzuData     string        `ox:"directory that a vega spec reads its data from - empty is the directory of the spec"`
	BlitzDark    bool          `ox:"render documents and pages dark"`
	PDFPage      string        `ox:"pdf page size of an image - fit/a4/letter,default:fit,name:pdf-page"`
	PDFMargin    uint          `ox:"pdf page margin of an image in points,default:36,name:pdf-margin"`
	Password     string        `ox:"password for encrypted documents"`
	ForceMime    string        `ox:"force mime type"`
	Out          string        `ox:"write to file instead of the terminal,short:o"`
	Encoder      string        `ox:"output encoder"`
	List         bool          `ox:"list registered decoders and encoders"`

	// ox sets these when the flag is given on the command line
	MinWidthSet  bool
	MinHeightSet bool
}

Args are the iv command arguments.

func New

func New() *Args

New creates the iv command arguments.

func (*Args) Config

func (a *Args) Config(stderr io.Writer) *ivctx.Config

Config builds the pipeline config from the command arguments.

func (*Args) Exec

func (a *Args) Exec(ctx context.Context, stdout, stderr io.Writer, cliargs []string) error

Exec runs the iv command.

func (*Args) Run

func (a *Args) Run(stdout, stderr io.Writer) func(context.Context, []string) error

Run returns the command's exec func.

type Target

type Target struct {
	Name     string
	IsString bool
}

Target is something to render: a path on disk, or a bare string argument such as a data: URL.

func Targets

func Targets(ctx context.Context, cliargs ...string) ([]Target, []error)

Targets expands the command line arguments into render targets. Directories expand to the files within them with a registered extension. Returns the targets along with the errors for the arguments that could not be expanded.

Jump to

Keyboard shortcuts

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