command

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPlanDiff = errors.New("plan contains changes")

ErrPlanDiff is returned by Plan.Run when --check is set and the plan contains executable DDL. main maps it to exit code 2. Suppressed drops alone do not trigger it.

Functions

func StartPager added in v1.9.1

func StartPager(w io.Writer, pager *bool) (io.Writer, func(), error)

StartPager wraps w with a pager subprocess when all of the following hold:

  • paging hasn't been disabled by --no-pager (pager != nil && *pager == false),
  • either pager was explicitly forced via --pager (*pager == true) or w is a TTY (so the user is actually viewing the output interactively),
  • PISTA_PAGER is set to a non-empty command line.

pager == nil means the user passed neither --pager nor --no-pager, so the TTY check decides. Otherwise *pager explicitly turns paging on or off, but an unset PISTA_PAGER still gates everything (matching the convention that the env var is the source of truth for *which* pager to run).

Otherwise it returns w unchanged with a no-op close. The returned close function tears down the pager and waits for it to exit, so callers should always invoke it (typically via defer).

Types

type Apply

type Apply struct {
	pistachio.ApplyOptions
}

func (*Apply) Run

func (cmd *Apply) Run(ctx context.Context, client *pistachio.Client, w io.Writer) error

type Dump

type Dump struct {
	pistachio.DumpOptions
}

func (*Dump) Run

func (cmd *Dump) Run(ctx context.Context, client *pistachio.Client, w io.Writer) error

type Plan

type Plan struct {
	pistachio.PlanOptions
	Check bool `env:"PISTA_CHECK" help:"Exit with code 2 when the plan contains executable changes."`
}

func (*Plan) Run

func (cmd *Plan) Run(ctx context.Context, client *pistachio.Client, w io.Writer) error

Jump to

Keyboard shortcuts

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