Repository navigation
fix(cmd): don't redefine vendored tool flag shorthands - #5496
Conversation
✅ Deploy Preview for zarf-docs canceled.
|
Signed-off-by: Allen Conlon <software@conlon.dev>
806b05d to
2673164
Compare
Codecov Report❌ Patch coverage is
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
AustinAbro321
left a comment
There was a problem hiding this comment.
Overall looks good, one comment for a previous bug that interacts with this
I did add those issues, a "fixes" and "relates to" so please let me know if that was right. |
Signed-off-by: Allen Conlon <software@conlon.dev>
AustinAbro321
left a comment
There was a problem hiding this comment.
LGTM, we'll need a more complex and complete solution at some point with #5507, but this does get rid of an existing panic. Appreciate you breaking this out
Description
zarf --log-level info tools helm listpanics onmaintoday:Root flags are registered whenever they are given ahead of the subcommand, and Zarf's
-l(--log-level) collides with Helm's-l/--selector.-a(--architecture) collides with Helm's-a/--allthe same way.The fix drops those two shorthands for exactly those invocations. The long flags are unaffected, and
zarf -l debug package deployis unaffected because the branch only triggers when the invocation targets a vendored tool.IsVendorCmdcould not be reused: it matches only when the vendored command sits at a fixed position, so it misses the form that panics.vendorCmdInArgsscansos.Argsfortools|t <vendored cmd>instead, and is used solely to decide whether to register the shorthands.Notes for review
Split out of #5489 at a reviewer's request, since there is more than one reasonable way to do this. The alternatives I did not take:
zarf -l debug …for every user.TraverseChildrenand friends) — the principled fix, but a much larger change to command setup for a flag collision.The arg scan is the smallest change that keeps both sides working. Its known limit is noted in a
shortcut:comment: a literaltoolsargument elsewhere on the line also matches, which costs only the-l/-ashorthands for that one invocation.Testing
A table test covers
vendorCmdInArgs, including the root-flag-before-subcommand form, thetalias, a non-vendoredtoolssubcommand, and a straytoolsargument.Verified by hand against builds of both
mainand this branch: the command above panics onmainand reaches Helm here;zarf tools helm list -l foo=barstill passes the selector through to Helm;zarf -l warn versionandzarf -a amd64 versionstill work.Related Issue
Relates to #5489
Fixes #5444
Relates to #5507
Checklist before merging