mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-04-30 12:00:39 +00:00
8c7017a99d
- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.5 KiB
1.5 KiB
Progress Bar Control Module (obidefault)
This Go package provides a simple, global mechanism to enable or disable progress bar display across an application.
Core Functionality
ProgressBar(): Returnstrueif progress bars are enabled (i.e., when__no_progress_bar__isfalse).NoProgressBar(): Returns the current state of__no_progress_bar__, i.e., whether progress bars are disabled.SetNoProgressBar(b bool): Sets the global flag__no_progress_bar__. Passingtruedisables progress bars; passingfalseenables them.NoProgressBarPtr(): Returns a pointer to the internal__no_progress_bar__variable, allowing direct read/write access (e.g., for reflection or UI binding).
Design Intent
- Centralizes progress bar visibility control in one place.
- Supports both boolean query/set and pointer-based manipulation for flexibility (e.g., CLI flags, config binding).
- Uses a negative flag name (
__no_progress_bar__) internally to default progress bars on (i.e.,false→ enabled).
Usage Example
// Disable progress bars globally:
obidefault.SetNoProgressBar(true)
// Check status:
if !obidefault.ProgressBar() {
log.Println("Progress bars are disabled.")
}
Notes
- Thread-safety is not guaranteed; concurrent access should be externally synchronized.
- The double underscore prefix (
__no_progress_bar__) signals internal/private usage per Go convention (though not enforced).