mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00
Progress bar are automagically disabled if stderr is redirected
Former-commit-id: 20a3a22db7dcf530b9e9cad9090b46f22db0d078
This commit is contained in:
@ -1,6 +1,10 @@
|
|||||||
package obiconvert
|
package obiconvert
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/DavidGamba/go-getoptions"
|
"github.com/DavidGamba/go-getoptions"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -182,7 +186,14 @@ func CLIAnalyzeOnly() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CLIProgressBar() bool {
|
func CLIProgressBar() bool {
|
||||||
return !__no_progress_bar__
|
// If the output is not a terminal, then we do not display the progress bar
|
||||||
|
o, _ := os.Stderr.Stat()
|
||||||
|
onTerminal := (o.Mode() & os.ModeCharDevice) == os.ModeCharDevice
|
||||||
|
if !onTerminal {
|
||||||
|
log.Info("Stderr is redirected, progress bar disabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
return onTerminal && !__no_progress_bar__
|
||||||
}
|
}
|
||||||
|
|
||||||
func CLIOutPutFileName() string {
|
func CLIOutPutFileName() string {
|
||||||
|
Reference in New Issue
Block a user