psyinfra / onyo

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

Should onyo allow to query for directories? #672

Open bpoldrack opened 1 month ago

bpoldrack commented 1 month ago

We have onyo get for querying the inventory for assets. We don't technically have something to query for directories. To some extend it could be done via get since - in principle - we have the directory key for assets. So, while it's conceptually a bit awkward most directory look ups could probably be done (like, say: onyo get --keys directory --match type=laptop make=apple to get all directories containing an apple laptop).

One type of query comes to mind, that can't be done: listing directories that are empty from onyo's POV (meaning: contain no assets).

This is probably an argument for an onyo list command, but we may want to think a bit about what kind of queries may be interesting and awkward or impossible to address by get.

Note on "in principle we have the directory key":

I don't think, we've properly ensured that's actually consistently the case, since initially it was meant for onyo new only. If we want that to be queryable (and I think we do), we need to make sure it's actually always filled in.