Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String Interpolation with a custom command #47

Open
gavmckee80 opened this issue Aug 17, 2021 · 0 comments
Open

String Interpolation with a custom command #47

gavmckee80 opened this issue Aug 17, 2021 · 0 comments

Comments

@gavmckee80
Copy link

@cheynearista

How do I implement a custom command where I pass a string to the GetCmd() function?

In my case below I want to build a command that returns only a single interface - testing with Ethernet1

type ShowInterfaceDescription struct {
	InterfaceDescriptions map[string]InterfaceInfo `json:"interfaceDescriptions"`
}

type InterfaceInfo struct {
	InterfaceStatus    string `json:"interfaceStatus"`
	Description        string `json:"description"`
	LineProtocolStatus string `json:"lineProtocolStatus"`
}

func (s *ShowInterfaceDescription) GetCmd() string {
	i := "Ethernet1"
	return fmt.Sprintf("show interfaces %v description", i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant