Open aqw opened 1 month ago
All templates already must be valid YAML files, so all template content is also queryable.
Is that true? I only remember that at some point in the beginning we decided to allow any type of text file. The main use-case was "close to yaml". Additionally, while reading this now I wonder if that might mess up the idea of allowing a json based onyo repository.
It should be considered what happens for a file .onyo/templates/readme.md
.
I had the same reaction, but it /must/ be true, because otherwise we wouldn't be able to set any keys/values into it.
Thus templates must be valid YAML.
It should be considered what happens for a file .onyo/templates/readme.md.
If that's used as a template, it will fail. If it's not intended for that it should be .onyoignore
d.
The main use-case was "close to yaml".
I get were that was coming from, but it would only ever make sense, if onyo new
was used interactively with --edit
and no other option given (including no layering template). I don't think we should consider this. It would mean to have this thing work with exactly one command with very particular options and fail in every other usecase for a template (with quite a bit of effort in implementation to allow for it in the one usecase where it could work).
The parent issue is #673
Allow
onyo get
to return data about templates. The type should be calledtemplate
. This issue supplants #552.All templates already must be valid YAML files, so all template content is also queryable. This could be quite handy if someone is managing a large collection of templates.
Pseudo Keys:
onyo.is.asset
:False
onyo.is.directory
:False
onyo.is.template
:True
onyo.is.empty
:True
orFalse
depending if the template contents are empty (see #674)onyo.path.relative
: path relative to the template directory (.onyo/templates
) rather than repo rootonyo.path.file
: path relative to repo rootonyo.path.parent
: path to parent directory relative to the template directoryTasks
onyo_get
onyo get
Open questions:
-i
and-x
be honored?onyo set
andonyo unset
? (see meta issue)