output

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommandOutput

func AddCommandOutput(ctx context.Context, opts AddCommandOutputOptions)

AddCommandOutput opts.OutputPath must include a %d to replace the execution number when opts.Executions > 1

func AddFailureOutput added in v1.4.0

func AddFailureOutput(outputPath string, command string, err error)

AddFailureOutput records a collection step that could not be executed at all, so that the archive says why instead of leaving the file empty or absent.

func AddHttpOutput added in v1.1.2

func AddHttpOutput(opts AddHttpOutputOptions)

func AddJsonOutput

func AddJsonOutput(opts AddJsonOutputOptions)

func AddOutputDirectory

func AddOutputDirectory(cfg *config.Config)

func CreateFile added in v1.4.0

func CreateFile(path string) (*os.File, error)

CreateFile creates the file and all missing parent directories.

func DoHttp added in v1.1.2

func DoHttp(options HttpOptions) ([]byte, error)

DoHttp reads the response into memory for callers that need to parse it. Use AddHttpOutput for responses that only end up in a file.

Unlike AddHttpOutput this takes no limit.Commands slot, and it must not: its callers crawl an extension while holding the port-forward the request goes through, and AddHttpOutput already holds a slot when it reaches doHttpRequest - acquiring one further down would nest the semaphore under itself and deadlock as soon as every slot is held by a caller waiting for the inner one. Concurrency here is bounded one level up, by limit.Items.

func DownloadOutput added in v1.1.2

func DownloadOutput(opts DownloadOptions)

func WriteToFile

func WriteToFile(path string, content []byte)

func ZipOutputDirectory

func ZipOutputDirectory(cfg *config.Config) string

Types

type AddCommandOutputOptions

type AddCommandOutputOptions struct {
	Config                 *config.Config
	CommandName            string
	CommandArgs            []string
	OutputPath             string
	Executions             int
	DelayBetweenExecutions *time.Duration
	ExecutionContext       string
	LogError               bool
	// Notes are recorded in the output file, for what the reader has to know to interpret it
	Notes []string
	// Timeout limits a single execution, starting once it acquired an execution slot. Zero means no limit.
	Timeout time.Duration
}

type AddHttpOutputOptions added in v1.1.2

type AddHttpOutputOptions struct {
	Config           *config.Config
	Method           string
	URL              url.URL
	OutputPath       string
	UseHttps         bool
	FormatJson       bool
	ExecutionContext string
	LogError         bool
}

type AddJsonOutputOptions

type AddJsonOutputOptions struct {
	Config     *config.Config
	Content    any
	OutputPath []string
}

type DownloadOptions added in v1.1.2

type DownloadOptions struct {
	Config     *config.Config
	Method     string
	URL        url.URL
	OutputPath string
}

type HttpOptions added in v1.1.2

type HttpOptions struct {
	Config     *config.Config
	Method     string
	URL        url.URL
	UseHttps   bool
	FormatJson bool
}

Jump to

Keyboard shortcuts

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