Epic bd-au0: Command Set Standardization & Flag Consistency Completed all 10 child issues: P0 tasks: - Standardize --dry-run flag across all commands (bd-au0.1) - Add label operations to bd update (bd-au0.2) - Fix --title vs --title-contains redundancy (bd-au0.3) - Standardize priority flag parsing (bd-au0.4) P1 tasks: - Add date/priority filters to bd search (bd-au0.5) - Add comprehensive filters to bd export (bd-au0.6) - Audit and standardize JSON output (bd-au0.7) P2 tasks: - Improve clean vs cleanup documentation (bd-au0.8) - Document rarely-used commands (bd-au0.9) P3 tasks: - Add global verbosity flags --verbose/-v and --quiet/-q (bd-au0.10) Key changes: - export.go: Added filters (assignee, type, labels, priority, dates) - main.go: Added --verbose/-v and --quiet/-q global flags - debug.go: Added SetVerbose/SetQuiet and PrintNormal helpers - clean.go/cleanup.go: Improved documentation with cross-references - detect_pollution.go: Added use cases and warnings - migrate_hash_ids.go: Marked as legacy command - rename_prefix.go: Added use cases documentation All success criteria met: flags standardized, feature parity achieved, naming clarified, JSON output consistent. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
59 lines
1.1 KiB
Go
59 lines
1.1 KiB
Go
package debug
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
var (
|
|
enabled = os.Getenv("BD_DEBUG") != ""
|
|
verboseMode = false
|
|
quietMode = false
|
|
)
|
|
|
|
func Enabled() bool {
|
|
return enabled || verboseMode
|
|
}
|
|
|
|
// SetVerbose enables verbose/debug output
|
|
func SetVerbose(verbose bool) {
|
|
verboseMode = verbose
|
|
}
|
|
|
|
// SetQuiet enables quiet mode (suppress non-essential output)
|
|
func SetQuiet(quiet bool) {
|
|
quietMode = quiet
|
|
}
|
|
|
|
// IsQuiet returns true if quiet mode is enabled
|
|
func IsQuiet() bool {
|
|
return quietMode
|
|
}
|
|
|
|
func Logf(format string, args ...interface{}) {
|
|
if enabled || verboseMode {
|
|
fmt.Fprintf(os.Stderr, format, args...)
|
|
}
|
|
}
|
|
|
|
func Printf(format string, args ...interface{}) {
|
|
if enabled || verboseMode {
|
|
fmt.Printf(format, args...)
|
|
}
|
|
}
|
|
|
|
// PrintNormal prints output unless quiet mode is enabled
|
|
// Use this for normal informational output that should be suppressed in quiet mode
|
|
func PrintNormal(format string, args ...interface{}) {
|
|
if !quietMode {
|
|
fmt.Printf(format, args...)
|
|
}
|
|
}
|
|
|
|
// PrintlnNormal prints a line unless quiet mode is enabled
|
|
func PrintlnNormal(args ...interface{}) {
|
|
if !quietMode {
|
|
fmt.Println(args...)
|
|
}
|
|
}
|