zrepl status: hide progress bar once all filesystems reach terminal state (#674)

* Added `IsTerminal` method
* Made rendering of progress bar conditional based on IsTerminal
This commit is contained in:
Tercio Filho
2023-05-02 14:28:56 -03:00
committed by GitHub
parent 2b3df7e342
commit 2b3daaf9f1
3 changed files with 40 additions and 15 deletions
+10
View File
@@ -199,6 +199,16 @@ const (
Done
)
// Returns true in case the State is a terminal state(PlanErr, ExecErr, Done)
func (s State) IsTerminal() bool {
switch s {
case PlanErr, ExecErr, Done:
return true
default:
return false
}
}
type updater func(func(*Pruner))
func (p *Pruner) Prune() {