Skip to content
Snippets Groups Projects
commandsListView.go 746 B
Newer Older
  • Learn to ignore specific revisions
  • package views
    
    import (
    	"github.com/gdamore/tcell"
    	"github.com/rivo/tview"
    )
    
    type CommandListView struct {
    	rootNode     *tview.TreeNode
    	commandsTree *tview.TreeView
    }
    
    func NewCommandListView(rootTitle string) *CommandListView {
    
    Malte Bauch's avatar
    Malte Bauch committed
    	v := &CommandListView{
    		rootNode:     tview.NewTreeNode(rootTitle),
    		commandsTree: tview.NewTreeView(),
    	}
    
    	v.commandsTree.
    		SetRoot(v.rootNode).
    		SetTitle("Commands").
    		SetBorder(true).
    		SetBorderColor(tcell.ColorSteelBlue)
    
    	return v
    }
    
    func (c *CommandListView) GetContent() tview.Primitive {
    	return c.commandsTree
    }
    
    func (v *CommandListView) GetCommands(path string) {
    	//TODO: change to use commandlist
    }
    
    func (v *CommandListView) SelectedFunc() {
    	//TODO: call GRPC calls for the selected item
    }