psyinfra / onyo

text-based inventory system on top of git
ISC License
3 stars 5 forks source link

New Feature: add `--type=template` to `onyo get` #675

Open aqw opened 1 month ago

aqw commented 1 month ago

The parent issue is #673

Allow onyo get to return data about templates. The type should be called template. 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:

Tasks


Open questions:

TobiasKadelka commented 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.

aqw commented 1 month ago

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.

bpoldrack commented 1 week ago

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 .onyoignored.

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).