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 {
}
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()
})
}
......@@ -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 {
......
......@@ -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)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment