mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-11-09 17:24:41 +00:00
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.
41 lines
839 B
Go
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
|
|
}
|