- 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>
- Add detailed docstring to setupFormatFlag explaining parameters and usage
- Add detailed docstring to setupTestCommand explaining return values
- Use constant.DefaultConversion instead of hard-coded constant.WebP for better maintainability
- Clarify when bindViper should be true vs false
Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com>
- Create setupTestCommand helper function to reduce test duplication
- Update all format flag tests to use shared setupFormatFlag function
- Remove unused enumflag import from test file
- Ensures test consistency with production code
- All tests continue to pass
Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com>
- Extract format flag setup logic into shared flags.go file
- Create setupFormatFlag function to eliminate duplication between optimize and watch commands
- Add bindViper parameter to support different flag binding strategies
- Remove duplicate enumflag imports from command files
- All tests continue to pass
Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com>
- 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>