mirror of
https://github.com/bcicen/ctop.git
synced 2024-08-30 18:23:19 +00:00
gofmt
This commit is contained in:
parent
fb5c825cf6
commit
28389aa38c
4
menus.go
4
menus.go
@ -177,9 +177,9 @@ func logReader(container *container.Container) (logs chan string, quit chan bool
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case log := <- stream:
|
||||
case log := <-stream:
|
||||
logs <- log.Message
|
||||
case <- quit:
|
||||
case <-quit:
|
||||
logCollector.Stop()
|
||||
close(logs)
|
||||
return
|
||||
|
@ -1,13 +1,14 @@
|
||||
package widgets
|
||||
|
||||
import (
|
||||
ui "github.com/gizak/termui"
|
||||
"fmt"
|
||||
|
||||
ui "github.com/gizak/termui"
|
||||
)
|
||||
|
||||
type TextView struct {
|
||||
ui.Block
|
||||
inputStream <- chan string
|
||||
inputStream <-chan string
|
||||
render chan bool
|
||||
Text []string // all the text
|
||||
TextOut []string // text to be displayed
|
||||
@ -16,7 +17,7 @@ type TextView struct {
|
||||
padding Padding
|
||||
}
|
||||
|
||||
func NewTextView(lines <- chan string) *TextView {
|
||||
func NewTextView(lines <-chan string) *TextView {
|
||||
i := &TextView{
|
||||
Block: *ui.NewBlock(),
|
||||
inputStream: lines,
|
||||
@ -67,12 +68,12 @@ func (i *TextView) renderLoop() {
|
||||
if size > len(i.Text) {
|
||||
size = len(i.Text)
|
||||
}
|
||||
i.TextOut = i.Text[len(i.Text) - size:]
|
||||
i.TextOut = i.Text[len(i.Text)-size:]
|
||||
|
||||
width := i.Width - (i.padding[0] * 2)
|
||||
for n := range i.TextOut {
|
||||
if len(i.TextOut[n]) > width {
|
||||
i.TextOut[n] = fmt.Sprintf("%s...", i.TextOut[n][:width - 3])
|
||||
i.TextOut[n] = fmt.Sprintf("%s...", i.TextOut[n][:width-3])
|
||||
}
|
||||
}
|
||||
ui.Render(i)
|
||||
|
Loading…
Reference in New Issue
Block a user