Add increment of lineCounter in Menu.iteration
This commit is contained in:
parent
e505fb654b
commit
65b0d132c1
|
@ -167,6 +167,7 @@ func (m *Menu) clearLines() {
|
||||||
|
|
||||||
func (m *Menu) iteration() {
|
func (m *Menu) iteration() {
|
||||||
fmt.Printf("%s\n", m.Title)
|
fmt.Printf("%s\n", m.Title)
|
||||||
|
m.lineCounter++
|
||||||
path := ""
|
path := ""
|
||||||
for node := m.cmdTree.Pointer; node != nil; node = node.Parent {
|
for node := m.cmdTree.Pointer; node != nil; node = node.Parent {
|
||||||
if node.Parent == nil {
|
if node.Parent == nil {
|
||||||
|
@ -176,6 +177,7 @@ func (m *Menu) iteration() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("At %s\n", path)
|
fmt.Printf("At %s\n", path)
|
||||||
|
m.lineCounter++
|
||||||
for _, node := range m.cmdTree.Pointer.Children {
|
for _, node := range m.cmdTree.Pointer.Children {
|
||||||
cmd := node.Val
|
cmd := node.Val
|
||||||
if cmd == nil {
|
if cmd == nil {
|
||||||
|
@ -183,9 +185,11 @@ func (m *Menu) iteration() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
cmd.Print()
|
cmd.Print()
|
||||||
|
m.lineCounter++
|
||||||
}
|
}
|
||||||
if m.cmdTree.Pointer != m.cmdTree.Root {
|
if m.cmdTree.Pointer != m.cmdTree.Root {
|
||||||
fmt.Printf("%s: Go back one layer\n", m.BackKey)
|
fmt.Printf("%s: Go back one layer\n", m.BackKey)
|
||||||
|
m.lineCounter++
|
||||||
}
|
}
|
||||||
stdinReader := bufio.NewReader(os.Stdin)
|
stdinReader := bufio.NewReader(os.Stdin)
|
||||||
msg, err := stdinReader.ReadString('\n')
|
msg, err := stdinReader.ReadString('\n')
|
||||||
|
@ -193,6 +197,7 @@ func (m *Menu) iteration() {
|
||||||
fmt.Printf("Error: ReadString: %v\n", err)
|
fmt.Printf("Error: ReadString: %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
m.lineCounter++
|
||||||
msg = strings.TrimRight(msg, "\n")
|
msg = strings.TrimRight(msg, "\n")
|
||||||
for _, node := range m.cmdTree.Pointer.Children {
|
for _, node := range m.cmdTree.Pointer.Children {
|
||||||
cmd := node.Val
|
cmd := node.Val
|
||||||
|
|
Loading…
Reference in New Issue
Block a user