stripe-cli
stripe-cli copied to clipboard
feat: add support for multiple fixture files in fixtures command
Summary
- Adds support for multiple fixture files to the
fixturescommand - Allows users to run multiple fixtures in a single command
- Processes fixture files sequentially in the order provided
Rationale
Previously, users needed to chain multiple stripe fixtures commands using &&:
stripe fixtures ./subscription.created.json && stripe fixtures ./teardown.json
This change allows a simpler syntax:
stripe fixtures ./subscription.created.json ./teardown.json
This improves developer experience by reducing repetition and making it easier to run multiple fixtures together.
Changes Made
-
pkg/cmd/fixtures.go:
- Changed argument validator from
ExactArgs(1)toMinimumNArgs(1)to accept one or more files - Added loop to process each fixture file sequentially
- Each file is executed in order with proper error handling
- Changed argument validator from
-
pkg/validators/cmds.go:
- Implemented
MinimumNArgs()validator function - Follows the same pattern as existing
MaximumNArgs()andExactArgs()validators - Provides clear error messages when too few arguments are provided
- Implemented
Test Plan
- Built the CLI successfully on Android/Linux (aarch64)
- Tested help output:
./stripe fixtures --helpdisplays correctly - Tested error handling:
./stripe fixturesshows appropriate error message - Verified the binary compiles and runs correctly
The implementation maintains backward compatibility - single file usage continues to work as before.
Fixes #910