modify layer compare formatting
This commit is contained in:
parent
83dfb0ae6e
commit
1b99e24da9
@ -92,7 +92,7 @@ func (node *FileNode) String() string {
|
|||||||
}
|
}
|
||||||
display = node.Name
|
display = node.Name
|
||||||
if node.Data.FileInfo.TarHeader.Typeflag == tar.TypeSymlink || node.Data.FileInfo.TarHeader.Typeflag == tar.TypeLink {
|
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)
|
return style.Sprint(display)
|
||||||
}
|
}
|
||||||
|
@ -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)))
|
fmt.Fprintln(view.header, Formatting.Header(vtclean.Clean(headerStr, false)))
|
||||||
|
|
||||||
return view.Render()
|
return view.Render()
|
||||||
@ -94,20 +94,33 @@ func (view *LayerView) getCompareIndexes() (bottomTreeStart, bottomTreeStop, top
|
|||||||
|
|
||||||
func (view *LayerView) renderCompareBar(layerIdx int) string {
|
func (view *LayerView) renderCompareBar(layerIdx int) string {
|
||||||
bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop := view.getCompareIndexes()
|
bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop := view.getCompareIndexes()
|
||||||
result := " "
|
result := " "
|
||||||
|
|
||||||
if debug {
|
//if debug {
|
||||||
v, _ := view.gui.View("debug")
|
// v, _ := view.gui.View("debug")
|
||||||
v.Clear()
|
// v.Clear()
|
||||||
_, _ = fmt.Fprintf(v, "bStart: %d bStop: %d tStart: %d tStop: %d", bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop)
|
// _, _ = fmt.Fprintf(v, "bStart: %d bStop: %d tStart: %d tStop: %d", bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop)
|
||||||
}
|
//}
|
||||||
|
|
||||||
if layerIdx >= bottomTreeStart && layerIdx <= bottomTreeStop {
|
if layerIdx >= bottomTreeStart && layerIdx <= bottomTreeStop {
|
||||||
result = Formatting.CompareBottom(" ")
|
result = Formatting.CompareBottom(" ")
|
||||||
}
|
}
|
||||||
if layerIdx >= topTreeStart && layerIdx <= topTreeStop {
|
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
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,9 +140,9 @@ func (view *LayerView) Render() error {
|
|||||||
compareBar := view.renderCompareBar(idx)
|
compareBar := view.renderCompareBar(idx)
|
||||||
|
|
||||||
if idx == view.LayerIndex {
|
if idx == view.LayerIndex {
|
||||||
fmt.Fprintln(view.view, compareBar + " " + Formatting.StatusBar(layerStr))
|
fmt.Fprintln(view.view, compareBar + " " + Formatting.StatusBar(layerStr))
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintln(view.view, compareBar + " " + layerStr)
|
fmt.Fprintln(view.view, compareBar + " " + layerStr)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package ui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/jroimartin/gocui"
|
"github.com/jroimartin/gocui"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user