Documentation ¶
Index ¶
- Constants
- func Gopt_Project_Main(proj gExpecter)
- type Project
- func (p *Project) Close() error
- func (p *Project) Expect__0(pattern string, timeout ...time.Duration) (out string, match []string, err error)
- func (p *Project) Expect__1(cs []expect.Caser, timeout ...time.Duration) (string, []string, int, error)
- func (p *Project) Expect__2(bat []expect.Batcher, timeout ...time.Duration) ([]expect.BatchRes, error)
- func (p *Project) Expect__3(re *regexp.Regexp, timeout ...time.Duration) (string, []string, error)
- func (p *Project) Send__0(in string) error
- func (p *Project) Send__1(sig os.Signal) error
- func (p *Project) Spawn__0(command string, timeout time.Duration, handle func(err error), ...) (err error)
- func (p *Project) Spawn__1(command []string, timeout time.Duration, handle func(err error), ...) (err error)
- func (p *Project) Spawn__2(sshClient *ssh.Client, timeout time.Duration, handle func(err error), ...) (err error)
- func (p *Project) Spawn__3(sshClient *ssh.Client, timeout time.Duration, term term.Termios, ...) (err error)
- func (p *Project) Spawn__4(opt *expect.GenOptions, timeout time.Duration, handle func(err error), ...) (err error)
- func (p *Project) Spawn__5(b []expect.Batcher, timeout time.Duration, handle func(err error), ...) (err error)
Constants ¶
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) 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 ¶
Expect reads spawned processes output looking for input regular expression. Timeout set to 0 makes Expect return the current buffer.
func (*Project) Send__1 ¶
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.