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,
//TODO: create own command in grpc -> commands
cv.commandsList.AddItem("AddPND", "closes the application", '!', func() {
rv.ChangeContentView("addPND")
app.SetFocus(rv.GetContent())
for i, command := range commands.CommandList {
f := command.Function
AddItem(command.Name, command.Description, rune('a'+i), func() {
cv.commandsList.AddItem("quit", "closes the application", 'q', func() {