aristanetworks / aristanetworks/goeapi

String Interpolation with a custom command

Open
#47 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
60
Forks
36
PR merge metrics
No merged PRs in 30d

Description

@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)
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the GetCmd() method and the custom command example in the issue. Determine how a caller should provide "Ethernet1" when constructing the command, then verify that the resulting command is "show interfaces Ethernet1 description"; the issue names no files or tests to guide further work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.