Open
Description
In a similar vein to #13, is it possible to Run()
multiple commands in a single session?
This fails with a panic on my system... a single command works just fine of course... single-command working copy, ref: route_views_go git hash 5e4bb51
.
Doing this may require something similar to go-expect. Will goph support this functionality natively, or do I need a third-party library?
package main
import (
"fmt"
"github.com/gleich/logoru"
"github.com/melbahja/goph"
)
func main() {
// route-views username 'rviews' with no password
client01, err := goph.New("rviews", "route-views.routeviews.org", goph.Password(""))
if err != nil {
logoru.Critical(err.Error())
}
defer client01.Close()
// get the best BGP route info for 4.2.2.2
cmdout01, err := client01.Run(fmt.Sprintf("show ip bgp %s bestpath", "4.2.2.2"))
if err != nil {
logoru.Critical(err.Error())
}
// get the best BGP route info for 8.8.8.8
cmdout02, err := client01.Run(fmt.Sprintf("show ip bgp %s bestpath", "8.8.8.8"))
if err != nil {
logoru.Critical(err.Error())
}
logoru.Info(string(cmdout01))
logoru.Info(string(cmdout02))
}
Metadata
Metadata
Assignees
Labels
No labels