shell

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2021 License: MIT Imports: 19 Imported by: 0

README

shell

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// If Host is set, it will be used, together with User, to establish a
	// remote, interactive SSH connection. If User is unset, it will default
	// to $USER environment variable.
	Host, User string
	// If connecting to Host fails, the ConnRetry field can be used to set
	// how many times should the shell try to connect before giving up.
	ConnRetry int
	// If the above Host is unset, then Name will be used as the name, or
	// file path, of the local shell to be executed in interactive mode.
	// If both, Host and Name, are unset, then the $SHELL environment variable
	// will be used to determine which shell to execute, and if that environment
	// variable is not set, then /bin/bash will be executed as default.
	Name string
	// A list of expressions used to configure the shell to re-try commands
	// that returned with a non-zero exit status.
	//
	// An expression MUST be of the following format:
	//
	//	"<prog_name>:<exit_status>:<count>"
	//
	// All three values in the expression MUST be non-empty.
	// - "prog_name" will be used to match the failed command's program name.
	//   Can be set to the wildcard "*" to match any program.
	// - "exit_status" will be used to match the failed command's exit status.
	//   MUST either be an integer in the range 1-255 (inclusive), or it
	//   can be set to the wildcard "*" to match any exit status.
	// - "count" is the number of re-tries that the shell should do.
	//   MUST be an integer greater than 0.
	CmdRetry []string
	// If set to true the shell will keep executing commands even if an error occurs.
	ContinueOnError bool
}

type Shell

type Shell interface {
	Err() error
	Close() error
	Exec(cmd string, a ...interface{}) error
	Out(cmd string, a ...interface{}) (string, error)
}

func New

func New(c Config) (_ Shell, err error)

Jump to

Keyboard shortcuts

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