expect

package module
v0.0.0-...-a55f24b Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: BSD-3-Clause Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

expect

Expect for Go+

Documentation

Index

Constants

View Source
const (
	GopPackage = true
)

Variables

This section is empty.

Functions

func Gopt_Project_Main

func Gopt_Project_Main(proj gExpecter)

Gopt_Project_Main is required by Go+ compiler as the entry of a .expect project.

Types

type Project

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

func (*Project) Close

func (p *Project) Close() error

func (*Project) Expect__0

func (p *Project) Expect__0(pattern string, timeout ...time.Duration) (out string, match []string, err error)

Expect reads spawned processes output looking for input regular expression. Timeout set to 0 makes Expect return the current buffer.

func (*Project) Expect__1

func (p *Project) Expect__1(cs []expect.Caser, timeout ...time.Duration) (string, []string, int, error)

Expect checks each Case against the accumulated out buffer, sending specified string back. Leaving Send empty will Send nothing to the process. Substring expansion can be used eg.

Case{`vf[0-9]{2}.[a-z]{3}[0-9]{2}\.net).*UP`,`show arp \1`}
Given: vf11.hnd01.net            UP      35 (4)        34 (4)          CONNECTED         0              0/0
Would send: show arp vf11.hnd01.net

func (*Project) Expect__2

func (p *Project) Expect__2(bat []expect.Batcher, timeout ...time.Duration) ([]expect.BatchRes, error)

Expect takes an array of BatchEntries and runs through them in order. For every Expect command a BatchRes entry is created with output buffer and sub matches. Failure of any of the batch commands will stop the execution, returning the results up to the failure.

func (*Project) Expect__3

func (p *Project) Expect__3(re *regexp.Regexp, timeout ...time.Duration) (string, []string, error)

Expect reads spawned processes output looking for input regular expression. Timeout set to 0 makes Expect return the current buffer.

func (*Project) Send__0

func (p *Project) Send__0(in string) error

Send sends a string to spawned process.

func (*Project) Send__1

func (p *Project) Send__1(sig os.Signal) error

Send sends a signal to the Expect controlled process. Only works on Process Expecters.

func (*Project) Spawn__0

func (p *Project) Spawn__0(
	command string, timeout time.Duration, handle func(err error), opts ...expect.Option) (err error)

Spawn starts a new process and collects the output. Arguments may not contain spaces.

func (*Project) Spawn__1

func (p *Project) Spawn__1(
	command []string, timeout time.Duration, handle func(err error), opts ...expect.Option) (err error)

Spawn starts a new process and collects the output. Arguments may contain spaces.

func (*Project) Spawn__2

func (p *Project) Spawn__2(
	sshClient *ssh.Client, timeout time.Duration, handle func(err error), opts ...expect.Option) (err error)

Spawn starts an interactive SSH session,ties it to a PTY and collects the output.

func (*Project) Spawn__3

func (p *Project) Spawn__3(
	sshClient *ssh.Client, timeout time.Duration, term term.Termios, handle func(err error), opts ...expect.Option) (err error)

Spawn starts an interactive SSH session and ties it to a local PTY, optionally requests a remote PTY.

func (*Project) Spawn__4

func (p *Project) Spawn__4(
	opt *expect.GenOptions, timeout time.Duration, handle func(err error), opts ...expect.Option) (err error)

Spawn is used to write generic Spawners.

func (*Project) Spawn__5

func (p *Project) Spawn__5(
	b []expect.Batcher, timeout time.Duration, handle func(err error), opts ...expect.Option) (err error)

Spawn spawns an expect.Batcher.

Jump to

Keyboard shortcuts

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