feat(cli): resolve $(...) expressions in string flag values#235
Conversation
Extends the existing config-file resolver registry (file, env, cmd,
keychain, etc.) so it also applies to string-typed CLI flag values.
This lets users load a file directly into any string flag, e.g.
elastic stack kb workflows post-workflows-workflow \
--yaml '$(file:./workflow.yaml)'
instead of having to inline shell-escaped contents. Works on both
hand-written OptionDefinitions and schema-derived string args, runs
before Zod validation, and surfaces missing files with a clear error
that names the offending flag. The fast path stays synchronous when
the value contains no expression so existing parser-based tests are
unaffected.
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts MegaLinter is graciously provided by OX Security |
|
Instead of having the |
I like this approach more than the resolver approach. However, there is already a global |
Extends the existing config-file resolver registry (file, env, cmd, keychain, etc.) so it also applies to string-typed CLI flag values.
This lets users load a file directly into any string flag, e.g.
Before to load a workflow directly from a file I had to run:
This is mostly convenience. Lets discuss also potential other options. Ideally this works the same across all files that can be loaded.