cmdrecord

package
v0.0.0-...-d10ad41 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

cmdrecord simplifies testing by implementing recording/playing back functionality for interacting with command line tools.

Index

Constants

View Source
const InteractionIdFile = "int-id.txt"
View Source
const ProxyConfigName = "proxy.config"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cassette

type Cassette struct {
	Version  string `yaml:"version"`
	ToolName string `yaml:"tool"`

	Interactions []Interaction `yaml:"interactions"`
}

type Interaction

type Interaction struct {
	Id       int      `yaml:"id"`
	Args     []string `yaml:"args"`
	ExitCode int      `yaml:"exitCode"`
	Stdout   string   `yaml:"stdout"`
	Stderr   string   `yaml:"stderr"`
}

type Intercept

type Intercept struct {
	ArgsMatch string `json:"argsMatch"`
}

type Options

type Options struct {
	CmdName      string        `json:"cmdName"`
	CassetteName string        `json:"cassettePath"`
	Intercepts   []Intercept   `json:"intercepts"`
	RecordMode   recorder.Mode `json:"recordMode"`
}

type Recorder

type Recorder struct {
	// contains filtered or unexported fields
}

func NewWithOptions

func NewWithOptions(opt Options) *Recorder

func (*Recorder) Start

func (r *Recorder) Start() (proxyDir string, err error)

Start sets up the proxy tool and returns the directory where the proxy is located.

The proxy tool is named exactly the same as the CmdName set. proxyDir can either be prepended directly to PATH or invoked directly by joining the proxyDir with the specified CmdName.

func (*Recorder) Stop

func (r *Recorder) Stop() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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