stripe-cli icon indicating copy to clipboard operation
stripe-cli copied to clipboard

feat: add support for multiple fixture files in fixtures command

Open cnaples79 opened this issue 3 months ago • 1 comments

Summary

  • Adds support for multiple fixture files to the fixtures command
  • 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) to MinimumNArgs(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
  • pkg/validators/cmds.go:

    • Implemented MinimumNArgs() validator function
    • Follows the same pattern as existing MaximumNArgs() and ExactArgs() validators
    • Provides clear error messages when too few arguments are provided

Test Plan

  • Built the CLI successfully on Android/Linux (aarch64)
  • Tested help output: ./stripe fixtures --help displays correctly
  • Tested error handling: ./stripe fixtures shows 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

cnaples79 avatar Oct 05 '25 02:10 cnaples79

CLA assistant check
All committers have signed the CLA.

cla-assistant[bot] avatar Oct 05 '25 02:10 cla-assistant[bot]