diff --git a/cmd/gosdn-tview/views/commandsListView.go b/cmd/gosdn-tview/views/commandsListView.go index cc4dc25028bbbebc9ec404f4d5e6a6fae964e168..15dd0126d6de234022d730eea46c113dbaef4cd1 100644 --- a/cmd/gosdn-tview/views/commandsListView.go +++ b/cmd/gosdn-tview/views/commandsListView.go @@ -13,33 +13,33 @@ type CommandListView struct { } func NewCommandListView() *CommandListView { - v := &CommandListView{ + cv := &CommandListView{ commandsList: tview.NewList(), } - v.commandsList. + cv.commandsList. SetBorder(true). SetBorderColor(tcell.ColorSteelBlue). SetTitle("Commands") - return v + return cv } -func (c *CommandListView) GetContent() tview.Primitive { - return c.commandsList +func (cv *CommandListView) GetContent() tview.Primitive { + return cv.commandsList } -func (v *CommandListView) GetCommands(app *app.App, rv *ResultAndInputView, +func (cv *CommandListView) GetCommands(app *app.App, rv *ResultAndInputView, conn *grpc.ClientConn) { for i, command := range commands.CommandList { f := command.Function - v.commandsList. + cv.commandsList. AddItem(command.Name, command.Description, rune('a'+i), func() { r := f(conn) rv.SetContent(r) }) } - v.commandsList.AddItem("quit", "closes the application", 'q', func() { + cv.commandsList.AddItem("quit", "closes the application", 'q', func() { app.Stop() }) } diff --git a/cmd/gosdn-tview/views/mainView.go b/cmd/gosdn-tview/views/mainView.go index 4c251af331037bb0eaa75ff96dab7aa33e041ca6..e2a1c4c42def69e1fd1d192e05f7db9b02fa6dcc 100644 --- a/cmd/gosdn-tview/views/mainView.go +++ b/cmd/gosdn-tview/views/mainView.go @@ -14,27 +14,27 @@ type MainView struct { } func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView { - v := &MainView{ + mv := &MainView{ pages: tview.NewPages(), mainFlexBox: createFlexBox(tview.FlexColumn), commandsListView: NewCommandListView(), resultAndInputView: NewResultAndInputView(), } - v.commandsListView.GetCommands(app, v.resultAndInputView, conn) + mv.commandsListView.GetCommands(app, mv.resultAndInputView, conn) commandsFlexBox := createFlexBox(tview.FlexRow) - commandsFlexBox.AddItem(v.commandsListView.GetContent(), 0, 40, true) + commandsFlexBox.AddItem(mv.commandsListView.GetContent(), 0, 40, true) resultAndInputFlexBox := createFlexBox(tview.FlexRow) - resultAndInputFlexBox.AddItem(v.resultAndInputView.GetContent(), 0, 10, false) + resultAndInputFlexBox.AddItem(mv.resultAndInputView.GetContent(), 0, 10, false) - v.mainFlexBox. + mv.mainFlexBox. AddItem(commandsFlexBox, 0, 1, true). AddItem(resultAndInputFlexBox, 0, 4, false) - v.pages.AddPage("main", v.mainFlexBox, true, true) + mv.pages.AddPage("main", mv.mainFlexBox, true, true) - return v + return mv } func (mv *MainView) GetContent() tview.Primitive { diff --git a/cmd/gosdn-tview/views/resultAndInputView.go b/cmd/gosdn-tview/views/resultAndInputView.go index 5be8adf8148b63bcb4200b3f544e30973b2caa8f..b46ca29e3c32a6bb673ec7c58d020a1d63e4031f 100644 --- a/cmd/gosdn-tview/views/resultAndInputView.go +++ b/cmd/gosdn-tview/views/resultAndInputView.go @@ -10,10 +10,10 @@ type ResultAndInputView struct { } func NewResultAndInputView() *ResultAndInputView { - v := &ResultAndInputView{ + rv := &ResultAndInputView{ resultAndInputView: tview.NewTextView(), } - v.resultAndInputView. + rv.resultAndInputView. SetDynamicColors(true). SetRegions(true). SetScrollable(true). @@ -21,14 +21,14 @@ func NewResultAndInputView() *ResultAndInputView { SetBorder(true). SetBorderColor(tcell.ColorSteelBlue) - return v + return rv } -func (r *ResultAndInputView) GetContent() tview.Primitive { - return r.resultAndInputView +func (rv *ResultAndInputView) GetContent() tview.Primitive { + return rv.resultAndInputView } -func (r *ResultAndInputView) SetContent(s string) { - r.resultAndInputView.Clear() - r.resultAndInputView.SetText(s) +func (rv *ResultAndInputView) SetContent(s string) { + rv.resultAndInputView.Clear() + rv.resultAndInputView.SetText(s) }