Newer
Older
"code.fbi.h-da.de/cocsn/gosdn/cmd/gosdn-tview/app"
commands "code.fbi.h-da.de/cocsn/gosdn/cmd/gosdn-tview/grpc"
//CommandListView is an application view to display all the goSDN commands
//NewCommandListView creates a new CommandListView
//GetContent returns the tview.Primitive belonging to the CommandListView
func (cv *CommandListView) GetContent() tview.Primitive {
return cv.commandsList
//GetCommands gets all goSDN commands from a command list and creates new
//tview.List items for each one of them. The specific gRPC functions are added
//as tview.Selected() function
func (cv *CommandListView) GetCommands(app *app.App, rv *ResultAndInputView,
cv.commandsList.AddItem("addPND", "closes the application", 'a', func() {
rv.ChangeContentView("addPND")
app.SetFocus(rv.GetContent())
for i, command := range commands.CommandList {
f := command.Function
AddItem(command.Name, command.Description, rune('b'+i), func() {
cv.commandsList.AddItem("log", "shows the log of goSDN", 'l', func() {
cv.commandsList.AddItem("quit", "closes the application", 'q', func() {