ncdu: add ! (errror) and . (unreadable) file flags to go with e (empty)

This commit is contained in:
Nick Craig-Wood 2020-12-28 15:20:23 +00:00
parent b218bc5bed
commit 5601652d65
1 changed files with 6 additions and 6 deletions

View File

@ -357,15 +357,18 @@ func (u *UI) Draw() error {
if isDir { if isDir {
mark = '/' mark = '/'
} }
fileFlag := ' '
message := "" message := ""
if !readable { if !readable {
message = " [not read yet]" message = " [not read yet]"
} }
if entriesHaveErrors { if entriesHaveErrors {
message = " [some subdirectories could not be read, size may be underestimated]" message = " [some subdirectories could not be read, size may be underestimated]"
fileFlag = '.'
} }
if err != nil { if err != nil {
message = fmt.Sprintf(" [%s]", err) message = fmt.Sprintf(" [%s]", err)
fileFlag = '!'
} }
extras := "" extras := ""
if u.showCounts { if u.showCounts {
@ -388,12 +391,9 @@ func (u *UI) Draw() error {
} }
} }
emptyDir := ""
if showEmptyDir { if showEmptyDir {
if isDir && count == 0 { if isDir && count == 0 && fileFlag == ' ' {
emptyDir = "e" fileFlag = 'e'
} else {
emptyDir = " "
} }
} }
if u.showGraph { if u.showGraph {
@ -406,7 +406,7 @@ func (u *UI) Draw() error {
} }
extras += "[" + graph[graphBars-bars:2*graphBars-bars] + "] " extras += "[" + graph[graphBars-bars:2*graphBars-bars] + "] "
} }
Linef(0, y, w, fg, bg, ' ', "%s %8v %s%c%s%s", emptyDir, fs.SizeSuffix(size), extras, mark, path.Base(entry.Remote()), message) Linef(0, y, w, fg, bg, ' ', "%c %8v %s%c%s%s", fileFlag, fs.SizeSuffix(size), extras, mark, path.Base(entry.Remote()), message)
y++ y++
} }
} }