mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2026-01-11 16:17:04 +01:00
Consolidate all common flags into flags.go
- Create individual setup functions for each common flag (quality, override, split, timeout) - Create setupCommonFlags function that sets up all common flags in one call - Simplify optimize_command.go and watch_command.go by using setupCommonFlags - All flags now centralized in flags.go for better maintainability - All tests continue to pass Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com>
This commit is contained in:
@@ -27,19 +27,8 @@ func init() {
|
||||
Args: cobra.ExactArgs(1),
|
||||
}
|
||||
|
||||
setupFormatFlag(command, &converterType, true)
|
||||
|
||||
command.Flags().Uint8P("quality", "q", 85, "Quality for conversion (0-100)")
|
||||
_ = viper.BindPFlag("quality", command.Flags().Lookup("quality"))
|
||||
|
||||
command.Flags().BoolP("override", "o", true, "Override the original CBZ/CBR files")
|
||||
_ = viper.BindPFlag("override", command.Flags().Lookup("override"))
|
||||
|
||||
command.Flags().BoolP("split", "s", false, "Split long pages into smaller chunks")
|
||||
_ = viper.BindPFlag("split", command.Flags().Lookup("split"))
|
||||
|
||||
command.Flags().DurationP("timeout", "t", 0, "Maximum time allowed for converting a single chapter (e.g., 30s, 5m, 1h). 0 means no timeout")
|
||||
_ = viper.BindPFlag("timeout", command.Flags().Lookup("timeout"))
|
||||
// Setup common flags (format, quality, override, split, timeout) with viper binding
|
||||
setupCommonFlags(command, &converterType, 85, true, false, true)
|
||||
|
||||
AddCommand(command)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user