feat: add --vars-file flag for layered input variables#227
Merged
josegonzalez merged 2 commits intomainfrom Apr 29, 2026
Merged
feat: add --vars-file flag for layered input variables#227josegonzalez merged 2 commits intomainfrom
josegonzalez merged 2 commits intomainfrom
Conversation
Adds a repeatable `--vars-file <path>` flag to `apply`, `plan`, and `validate` for loading input values from external YAML or JSON files. Precedence runs from file-level `inputs:` defaults at the bottom up to `--name=value` CLI flags at the top, with `--vars-file` slotting in between defaults and CLI flags. Multiple `--vars-file` arguments merge left-to-right so later files override earlier ones, unknown keys error with a Levenshtein-based suggestion against the declared input names, and values are coerced to the input's declared type so JSON numbers and YAML bools land correctly without per-call branching downstream.
`stat -f "%m" tasks.yml` partially succeeds on Linux because `-f` switches stat to filesystem-info mode and `tasks.yml` is treated as a valid filesystem to inspect, leaving extraneous block-free output in the captured variable. The previous fallback order ran the macOS form first, so on Linux both `before_mtime` and `after_mtime` carried that varying filesystem info and the equality check failed whenever disk usage shifted during the 1s sleep. Running the GNU `-c "%Y"` form first keeps Linux on the cleanly-succeeding branch and only falls back on macOS where `-c` is unsupported.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a repeatable
--vars-file <path>flag toapply,plan, andvalidatefor loading input values from external YAML or JSON files. Precedence runs from file-levelinputs:defaults at the bottom up to--name=valueCLI flags at the top, with--vars-fileslotting in between defaults and CLI flags. Multiple--vars-filearguments merge left-to-right so later files override earlier ones, unknown keys error with a Levenshtein-based suggestion against the declared input names, and values are coerced to the input's declared type so JSON numbers and YAML bools land correctly without per-call branching downstream.Also includes a small drive-by fix for the
docket fmt is a no-op on already-canonical input (mtime preserved)bats test. The previousstat -f "%m" tasks.yml 2>/dev/null || stat -c "%Y" tasks.ymlordering ran the macOS form first, but on Linux-fswitches stat to filesystem-info mode and produces non-mtime output that varies between calls, so the captured mtime values differed whenever disk usage shifted during the 1s sleep. Reversing the order keeps Linux on the cleanly-succeeding GNU branch and only falls back on macOS.Closes #207.