mirror of
https://github.com/Belphemur/CBZOptimizer.git
synced 2026-01-11 16:17:04 +01:00
Fix format flag crash and add comprehensive tests
- Remove NoOptDefVal which caused the format flag to fail with space-separated values - Add 5 comprehensive unit tests for format flag: space syntax, short form, equals syntax, default value, and case-insensitive - Update README with detailed format flag documentation and examples - Format flag now works with all syntaxes: --format webp, -f webp, --format=webp - Default value (webp) is preserved and shown in help text Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com>
This commit is contained in:
@@ -33,11 +33,10 @@ func init() {
|
||||
command.Flags().BoolP("override", "o", false, "Override the original CBZ/CBR files")
|
||||
command.Flags().BoolP("split", "s", false, "Split long pages into smaller chunks")
|
||||
command.Flags().DurationP("timeout", "t", 0, "Maximum time allowed for converting a single chapter (e.g., 30s, 5m, 1h). 0 means no timeout")
|
||||
command.PersistentFlags().VarP(
|
||||
command.Flags().VarP(
|
||||
formatFlag,
|
||||
"format", "f",
|
||||
fmt.Sprintf("Format to convert the images to: %s", constant.ListAll()))
|
||||
command.PersistentFlags().Lookup("format").NoOptDefVal = constant.DefaultConversion.String()
|
||||
|
||||
AddCommand(command)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user