carvel-dev / ytt

YAML templating tool that works on YAML structure instead of text
https://carvel.dev/ytt
Apache License 2.0
1.68k stars 137 forks source link

--file-mark '**/*.ext:type=xxx' should not error when no files matched #624

Open GrahamDumpleton opened 2 years ago

GrahamDumpleton commented 2 years ago

Describe the problem/challenge you have

If using file marks and you use a pattern if no files match then ytt errors when there is really no need for it to error.

ytt -f workshop-template --file-mark '**/*:type=text-plain' --file-mark '**/*.star:type=starlark' --file-mark '**/*.md:type=text-template' --file-mark '**/*.yaml:type=yaml-template' --file-mark '**/*.yml:type=yaml-template' --output-files=/tmp/workshop
ytt: Error: Expected file mark '**/*.star:type=starlark' to match at least one file by path, but did not

For the case where an explicit file name is given, then yes error. Eg., for --file-mark 'file.ext:type=xxx'. Just not when it is a wildcard.

Not giving an error when using wildcards makes it practical to use ytt as a template system for creating a whole directory hierarchy of output files when using --output-files. Ie., a cookiecutter (https://cookiecutter.readthedocs.io/en/1.7.2/_) equivalent.

Describe the solution you'd like

Don't cause a fatal error when no files match a file mark pattern with * in it. Eg., don't error for *.ext or **/*.ext.

Anything else you would like to add:

Nope.


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

github-actions[bot] commented 2 years ago

This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.

GrahamDumpleton commented 2 years ago

Still want to see this.

pivotaljohn commented 2 years ago

Yeah, so do we. Aggressive little stalebot.

Moving this into "Carvel Accepted" to make that clear.