fix status

This commit is contained in:
Christian Zangl 2024-08-18 16:05:33 +02:00
parent 90b406b066
commit 24b3a88576
No known key found for this signature in database
GPG Key ID: 6D468AC36E2A4B3D
3 changed files with 13 additions and 10 deletions

View File

@ -25,7 +25,7 @@ const (
) )
const ( const (
updateInterval = time.Millisecond * 300 updateInterval = time.Millisecond * 700
sizeMB int64 = 1024 * 1024 sizeMB int64 = 1024 * 1024
) )
@ -80,7 +80,7 @@ func (m *Main) log(text string) {
m.logger.Println(time.Now().UTC().Format("2006-01-02 15:04:05"), text) m.logger.Println(time.Now().UTC().Format("2006-01-02 15:04:05"), text)
} }
func (m *Main) logStatus(stat chkbit.Status, path string) { func (m *Main) logStatus(stat chkbit.Status, path string) bool {
if stat == chkbit.STATUS_UPDATE_INDEX { if stat == chkbit.STATUS_UPDATE_INDEX {
m.numIdxUpd++ m.numIdxUpd++
} else { } else {
@ -108,8 +108,10 @@ func (m *Main) logStatus(stat chkbit.Status, path string) {
col = termAlertFG col = termAlertFG
} }
lterm.Printline(col, stat.String(), " ", path, lterm.Reset) lterm.Printline(col, stat.String(), " ", path, lterm.Reset)
return true
} }
} }
return false
} }
func (m *Main) showStatus(context *chkbit.Context) { func (m *Main) showStatus(context *chkbit.Context) {
@ -124,11 +126,12 @@ func (m *Main) showStatus(context *chkbit.Context) {
} }
return return
} }
m.logStatus(item.Stat, item.Message) if m.logStatus(item.Stat, item.Message) {
if m.progress == Fancy { if m.progress == Fancy {
lterm.Write(termBG, termFG1, stat, lterm.ClearLine(0), lterm.Reset, "\r") lterm.Write(termBG, termFG1, stat, lterm.ClearLine(0), lterm.Reset, "\r")
} else { } else {
fmt.Print(m.total, "\r") fmt.Print(m.total, "\r")
}
} }
case perf := <-context.PerfQueue: case perf := <-context.PerfQueue:
now := time.Now() now := time.Now()

View File

@ -10,4 +10,4 @@ mv $root/root/people $root/people
ln -s ../people people ln -s ../people people
ln -s ../../people/face/office-door.pdf day/friend/office-door.pdf ln -s ../../people/face/office-door.pdf day/friend/office-door.pdf
find -L | wc -l find -L -type f | wc -l

View File

@ -16,6 +16,6 @@ fi
$script_dir/build $script_dir/build
"$base_dir/chkbit" -u /tmp/chkbit "$base_dir/chkbit" -u /tmp/chkbit/root
# todo: validate # todo: validate (300 files, 1 symlink dir followed, 1 symlink file ignored)