cli

package
v2.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package cli implements the stable command-line and JSON protocol surface.

Index

Constants

View Source
const Protocol = 1

Variables

This section is empty.

Functions

func NotifyContext

func NotifyContext(parent context.Context) (context.Context, context.CancelFunc)

NotifyContext records which signal interrupted the CLI, for forwarding and conventional shell exit codes. It never installs handlers in the library.

Types

type App

type App struct {
	In         io.Reader
	Out, Err   io.Writer
	Getenv     func(string) string
	Executable string
}

func (App) Main

func (a App) Main(ctx context.Context, args []string) int

type Event

type Event struct {
	Protocol      int    `json:"protocol"`
	Event         string `json:"event"`
	Version       string `json:"version,omitempty"`
	ConnectionURL string `json:"connection_url,omitempty"`
	Port          uint32 `json:"port,omitempty"`
	StateFile     string `json:"state_file,omitempty"`
	Error         string `json:"error,omitempty"`
}

type Options

type Options struct {
	Version      string            `json:"postgres_version"`
	Port         uint              `json:"port"`
	Database     string            `json:"database"`
	Username     string            `json:"username"`
	Password     string            `json:"password"`
	CacheDir     string            `json:"cache_dir"`
	WorkDir      string            `json:"work_dir"`
	DataDir      string            `json:"data_dir"`
	Binaries     string            `json:"binaries"`
	Mirror       string            `json:"mirror"`
	User         string            `json:"user"`
	SocketDir    string            `json:"socket_dir"`
	StartTimeout string            `json:"start_timeout"`
	StopTimeout  string            `json:"stop_timeout"`
	Parameters   map[string]string `json:"parameters"`
	Offline      bool              `json:"offline"`
	JSON         bool              `json:"json"`
	ParentStdin  bool              `json:"parent_stdin"`
	StateFile    string            `json:"state_file"`
}

Options is the JSON configuration schema. Flags override environment, which overrides the file. Durations use Go syntax, for example "30s".

Jump to

Keyboard shortcuts

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