Skip to content

Pagination, SendInteractive #194

Answered by carlmontanari
zaits07 asked this question in Q&A
Discussion options

You must be logged in to vote

👋 hey @zaits07

package main

import (
	"bytes"
	"fmt"
	"github.com/scrapli/scrapligo/driver/generic"
	"github.com/scrapli/scrapligo/driver/options"
	"time"
)

func main() {
	var channelLog bytes.Buffer

	d, err := generic.NewDriver(
		"1.2.3.4",
		options.WithTransportType("system"),
		options.WithAuthNoStrictKey(),
		options.WithSSHConfigFileSystem(),
		options.WithChannelLog(&channelLog),
	)
	if err != nil {
		panic(err)
	}

	err = d.Open()
	if err != nil {
		panic(err)
	}

	defer d.Close()

	r, err := d.SendWithCallbacks("show run", []*generic.Callback{
		{
			Callback: func(driver *generic.Driver, s string) error {
				return driver.Channel.Write([]byte(" "), false)
			},
			Contains:…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zaits07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants