edmain

package
v0.250527.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: 0BSD Imports: 35 Imported by: 0

Documentation

Overview

Package edmain (EffDump MAIN) implements the CLI integration of the tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(kvs []keyvalue.KV, sepch byte, hash uint64) (data []byte, err error)

Compress compresses `kvs` into a byte stream suitable for saving to disk. It's a gzip compressed textar with sepch used as the separator character. Returns an error if kvs is not sorted or encoding hit internal limits.

func Hash

func Hash(kvs []keyvalue.KV) uint64

Hash hashes a keyvalue slice.

func MakeRE

func MakeRE(globs ...string) *regexp.Regexp

MakeRE makes a single regex from a set of globs.

func PeekHash

func PeekHash(f io.Reader) uint64

PeekHash returns the hash stored in the gzip header.

func Stringify

func Stringify(v any) string

Stringify converts any type to a string representation suitable to use in effects.

func Uncompress

func Uncompress(data []byte) ([]keyvalue.KV, error)

Uncompress decodes a compressed textar stream. See Marshal() for info about the format. The function is safe: it won't eat up all memory on adversial input or on a huge effdump. It only accepts effdumps within the limits.

Types

type Params

type Params struct {
	Name         string
	Effects      []keyvalue.KV
	Stdout       io.Writer
	Args         []string
	Env          []string
	Flagset      *flag.FlagSet // for Usage().
	VSHasChanges func(context.Context) (dirty bool, err error)
	VSResolve    func(ctx context.Context, revision string) (version string, err error)

	// Flags. Must be parsed by the caller after RegisterFlags.
	Address      string
	Color        string
	ContextLines int
	Force        bool
	Keyptr       string
	Revision     string
	Sepch        string
	Subkey       string
	Template     string
	Version      string
	Watch        bool
	RMRegexp     string
	// contains filtered or unexported fields
}

Params contains most of the I/O dependencies for the Run().

func (*Params) RegisterFlags

func (p *Params) RegisterFlags(fs *flag.FlagSet)

RegisterFlags registers effdump's flags into a flagset.

func (*Params) Run

func (p *Params) Run(ctx context.Context) error

Run runs effdump's main CLI logic.

func (*Params) Usage

func (p *Params) Usage()

Usage prints a help message to p.Stdout.

Jump to

Keyboard shortcuts

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