externalcmd

package
v0.0.0-...-c4af43d Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input interface {
	/*
		SendTo sends the input data held by this object to the given command. This
		may involve either adding arguments or redirecting stdin, as well as file IO.
		tempDir is a path to a temporary directory that may be used by the strategy
		to write intermediate files. It is the caller's responsibility to clean up
		the directory when the parser has been run.
	*/
	SendTo(cmd *exec.Cmd, argHandler InputArgHandler, tempDir string) error
}

Input allows different ways of passing input to an external command, for example a list of files or a raw string. Each instance represents specific input data.

func MultipleFileInput

func MultipleFileInput(paths []string) Input

func SingleFileInput

func SingleFileInput(path string) Input

func StringInput

func StringInput(rawInput string) Input

type InputArgHandler

type InputArgHandler interface {
	// ReadStdinArg returns the command line arguments which
	// specify that the command should read input from stdin
	ReadStdinArg() []string

	// SingleFileArg returns the command line arguments which
	// specify the path to a single input file for the command.
	SingleFileArg(filePath string) []string

	// FileListArg returns the command line arguments which
	// specify the path to a file that contains a list of
	// files that should be processed by the command
	FileListArg(fileListPath string) []string
}

InputArgHandler abstracts command-specific behaviour for how to pass files as command line arguments, including which option strings to use.

Jump to

Keyboard shortcuts

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