modify layer compare formatting

This commit is contained in:
Alex Goodman 2018-06-25 09:08:39 -04:00
parent 83dfb0ae6e
commit 1b99e24da9
No known key found for this signature in database
GPG Key ID: 05328C611D8A520E
3 changed files with 26 additions and 13 deletions

View File

@ -92,7 +92,7 @@ func (node *FileNode) String() string {
}
display = node.Name
if node.Data.FileInfo.TarHeader.Typeflag == tar.TypeSymlink || node.Data.FileInfo.TarHeader.Typeflag == tar.TypeLink {
display += " -> " + node.Data.FileInfo.TarHeader.Linkname
display += " " + node.Data.FileInfo.TarHeader.Linkname
}
return style.Sprint(display)
}

View File

@ -62,7 +62,7 @@ func (view *LayerView) Setup(v *gocui.View, header *gocui.View) error {
}
headerStr := fmt.Sprintf("C "+image.LayerFormat, "Image ID", "Size", "Command")
headerStr := fmt.Sprintf("Cmp "+image.LayerFormat, "Image ID", "Size", "Command")
fmt.Fprintln(view.header, Formatting.Header(vtclean.Clean(headerStr, false)))
return view.Render()
@ -94,20 +94,33 @@ func (view *LayerView) getCompareIndexes() (bottomTreeStart, bottomTreeStop, top
func (view *LayerView) renderCompareBar(layerIdx int) string {
bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop := view.getCompareIndexes()
result := " "
result := " "
if debug {
v, _ := view.gui.View("debug")
v.Clear()
_, _ = fmt.Fprintf(v, "bStart: %d bStop: %d tStart: %d tStop: %d", bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop)
}
//if debug {
// v, _ := view.gui.View("debug")
// v.Clear()
// _, _ = fmt.Fprintf(v, "bStart: %d bStop: %d tStart: %d tStop: %d", bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop)
//}
if layerIdx >= bottomTreeStart && layerIdx <= bottomTreeStop {
result = Formatting.CompareBottom(" ")
result = Formatting.CompareBottom(" ")
}
if layerIdx >= topTreeStart && layerIdx <= topTreeStop {
result = Formatting.CompareTop(" ")
result = Formatting.CompareTop(" ")
}
//if bottomTreeStop == topTreeStart {
// result += " "
//} else {
// if layerIdx == bottomTreeStop {
// result += "─┐"
// } else if layerIdx == topTreeStart {
// result += "─┘"
// } else {
// result += " "
// }
//}
return result
}
@ -127,9 +140,9 @@ func (view *LayerView) Render() error {
compareBar := view.renderCompareBar(idx)
if idx == view.LayerIndex {
fmt.Fprintln(view.view, compareBar + " " + Formatting.StatusBar(layerStr))
fmt.Fprintln(view.view, compareBar + " " + Formatting.StatusBar(layerStr))
} else {
fmt.Fprintln(view.view, compareBar + " " + layerStr)
fmt.Fprintln(view.view, compareBar + " " + layerStr)
}
}

View File

@ -2,7 +2,7 @@ package ui
import (
"fmt"
"github.com/jroimartin/gocui"
)