cli: support multiple --path values in export command - #387
mateuscmtropical wants to merge 1 commit into
Conversation
📝 Contributor License Agreement requiredBefore this PR can merge, every contributor must sign the Infisical CLA. Still needs to sign: Once everyone has signed, the check updates automatically — no need to close and reopen the PR. |
|
| Filename | Overview |
|---|---|
| packages/cmd/export.go | Adds repeatable path handling and deterministic last-path-wins merging before tag filtering and formatting. |
| packages/cmd/export_test.go | Adds focused coverage for merging, tag precedence, deterministic ordering, and repeated StringArray flag values. |
| packages/util/log.go | Uses errors.As so wrapped API errors retain specialized user-facing formatting. |
Reviews (1): Last reviewed commit: "cli: support multiple --path values in e..." | Re-trigger Greptile
`run` already supported multiple `--path` flags. `export` only took one. This brings `export` up to the same behavior: `--path` is now a StringArray (matching run.go), reuses run.go's fetchSecrets to fetch secrets from each path, and merges duplicate keys across paths (last path wins). Tag filtering now happens once, client-side, after the merge, instead of being applied per-path on the server -- otherwise a tagged value from an earlier path could survive over a later path's untagged override. Also fixes a related bug in error handling: wrapped API errors weren't unwrapped before the pretty-print check in PrintErrorAndExit, so failures showed a generic error instead of the formatted one. Closes Infisical/infisical#900
1c4eacd to
43a5d3a
Compare
|
Closing in favor of a fresh PR from a clean branch. |
|
Superseded by #388. |
This implements #900 (specify multiple paths in the CLI).
runalready supported multiple--pathflags.exportonly took one. This bringsexportup to the same behavior:--pathis now aStringArray, matchingrun's existing flagrun'sfetchSecretsto fetch secrets from each pathTested manually against a real project (multiple folders, with and without tag filtering) and with
go test ./packages/cmd/... -count=2.Closes Infisical/infisical#900
Student contribution for a free software course. Feedback welcome.