mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-11-09 17:24:41 +00:00
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.
This commit is contained in:
1 parent
db2b398dd0
commit
1d692d7e0b
5 files changed
+141
-1
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package obidefault
|
||||
|
||||
import "os"
|
||||
|
||||
var __no_progress_bar__ = false
|
||||
|
||||
func ProgressBar() bool {
|
||||
@@ -17,3 +19,22 @@ func SetNoProgressBar(b bool) {
|
||||
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
|
||||
}
|
||||
Reference in new issue
Block a user