Skip to content
Snippets Groups Projects
Commit 8f3d1d99 authored by Malte Bauch's avatar Malte Bauch
Browse files

fixing lint errrors

parent 36d26537
Branches
Tags
3 merge requests!90Develop,!59Resolve "Simple ncurse-alike cli to manage gosdn",!53V.0.1.0 Codename Threadbare
Pipeline #52856 passed
...@@ -13,33 +13,33 @@ type CommandListView struct { ...@@ -13,33 +13,33 @@ type CommandListView struct {
} }
func NewCommandListView() *CommandListView { func NewCommandListView() *CommandListView {
v := &CommandListView{ cv := &CommandListView{
commandsList: tview.NewList(), commandsList: tview.NewList(),
} }
v.commandsList. cv.commandsList.
SetBorder(true). SetBorder(true).
SetBorderColor(tcell.ColorSteelBlue). SetBorderColor(tcell.ColorSteelBlue).
SetTitle("Commands") SetTitle("Commands")
return v return cv
} }
func (c *CommandListView) GetContent() tview.Primitive { func (cv *CommandListView) GetContent() tview.Primitive {
return c.commandsList return cv.commandsList
} }
func (v *CommandListView) GetCommands(app *app.App, rv *ResultAndInputView, func (cv *CommandListView) GetCommands(app *app.App, rv *ResultAndInputView,
conn *grpc.ClientConn) { conn *grpc.ClientConn) {
for i, command := range commands.CommandList { for i, command := range commands.CommandList {
f := command.Function f := command.Function
v.commandsList. cv.commandsList.
AddItem(command.Name, command.Description, rune('a'+i), func() { AddItem(command.Name, command.Description, rune('a'+i), func() {
r := f(conn) r := f(conn)
rv.SetContent(r) rv.SetContent(r)
}) })
} }
v.commandsList.AddItem("quit", "closes the application", 'q', func() { cv.commandsList.AddItem("quit", "closes the application", 'q', func() {
app.Stop() app.Stop()
}) })
} }
...@@ -14,27 +14,27 @@ type MainView struct { ...@@ -14,27 +14,27 @@ type MainView struct {
} }
func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView { func NewMainView(app *app.App, conn *grpc.ClientConn) *MainView {
v := &MainView{ mv := &MainView{
pages: tview.NewPages(), pages: tview.NewPages(),
mainFlexBox: createFlexBox(tview.FlexColumn), mainFlexBox: createFlexBox(tview.FlexColumn),
commandsListView: NewCommandListView(), commandsListView: NewCommandListView(),
resultAndInputView: NewResultAndInputView(), resultAndInputView: NewResultAndInputView(),
} }
v.commandsListView.GetCommands(app, v.resultAndInputView, conn) mv.commandsListView.GetCommands(app, mv.resultAndInputView, conn)
commandsFlexBox := createFlexBox(tview.FlexRow) 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 := 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(commandsFlexBox, 0, 1, true).
AddItem(resultAndInputFlexBox, 0, 4, false) 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 { func (mv *MainView) GetContent() tview.Primitive {
......
...@@ -10,10 +10,10 @@ type ResultAndInputView struct { ...@@ -10,10 +10,10 @@ type ResultAndInputView struct {
} }
func NewResultAndInputView() *ResultAndInputView { func NewResultAndInputView() *ResultAndInputView {
v := &ResultAndInputView{ rv := &ResultAndInputView{
resultAndInputView: tview.NewTextView(), resultAndInputView: tview.NewTextView(),
} }
v.resultAndInputView. rv.resultAndInputView.
SetDynamicColors(true). SetDynamicColors(true).
SetRegions(true). SetRegions(true).
SetScrollable(true). SetScrollable(true).
...@@ -21,14 +21,14 @@ func NewResultAndInputView() *ResultAndInputView { ...@@ -21,14 +21,14 @@ func NewResultAndInputView() *ResultAndInputView {
SetBorder(true). SetBorder(true).
SetBorderColor(tcell.ColorSteelBlue) SetBorderColor(tcell.ColorSteelBlue)
return v return rv
} }
func (r *ResultAndInputView) GetContent() tview.Primitive { func (rv *ResultAndInputView) GetContent() tview.Primitive {
return r.resultAndInputView return rv.resultAndInputView
} }
func (r *ResultAndInputView) SetContent(s string) { func (rv *ResultAndInputView) SetContent(s string) {
r.resultAndInputView.Clear() rv.resultAndInputView.Clear()
r.resultAndInputView.SetText(s) rv.resultAndInputView.SetText(s)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment