Files
obitools4/pkg/obidefault/progressbar.go
T
Eric Coissac 1d692d7e0b Implement progress tracking for clique finding
Introduces a mechanism for tracking progress during clique finding operations. This includes implementing a progress bar state management system, handling visibility checks, and integrating progress reporting into the clique finding logic and result processing.
2026-11-03 09:26:29 +11:00

41 lines
839 B
Go

package obidefault
import "os"
var __no_progress_bar__ = false
func ProgressBar() bool {
return !__no_progress_bar__
}
func NoProgressBar() bool {
return __no_progress_bar__
}
func SetNoProgressBar(b bool) {
__no_progress_bar__ = b
}
func NoProgressBarPtr() *bool {
return &__no_progress_bar__
}
// ProgressBarVisible tells whether a progress bar can be displayed: it is not
// disabled by --no-progressbar, the standard error output is a terminal and
// the standard output is not piped to another command.
func ProgressBarVisible() bool {
if !ProgressBar() {
return false
}
if e, err := os.Stderr.Stat(); err != nil || (e.Mode()&os.ModeCharDevice) != os.ModeCharDevice {
return false
}
if o, err := os.Stdout.Stat(); err == nil && (o.Mode()&os.ModeNamedPipe) == os.ModeNamedPipe {
return false
}
return true
}