vctx: set VAULT_FORMAT from the vault command #3
Reference in New Issue
Block a user
Delete Branch "benvin/vctx-format"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
vault defaults to table output, which is awkward for
kv getand dynamic creds. vctx now picks a sensible VAULT_FORMAT per command while leaving explicit choices alone.kv getand paths containing/creds/kv list; leave it unset otherwise-format/-fieldprecedes----formatflag to force VAULT_FORMAT, overriding the environmentrawis offered/documented as a general--format, but vault rejects VAULT_FORMAT=raw on every command exceptvault read("This command does not support the -format=raw option.") → droprawor document it asread-only-format/-fieldafter--still suppress auto-format, but vault stops scanning global flags at--→ stop the loop at----formatis appended after an ambientVAULT_FORMAT; Go (vault) keeps the FIRST duplicate env key after exec, soVAULT_FORMAT=yaml vctx --format json ...runs with yaml (docs/vctx.md:51 "always sets it" is false) → drop existingVAULT_FORMAT=entries from baseEnv before appending (same applies to the VAULT_ADDR/TOKEN/NAMESPACE appends; comment at :110 is wrong)lastValencodes last-wins, so tests pass on the broken case → add a case with ambientVAULT_FORMAT+ flag and assert exactly oneVAULT_FORMATentry--formaton top.--formatcompletion omitsraw, which docs/vctx.md:51 advertises → addrawto the completion list.