psyinfra / onyo

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

`onyo get --match directory=shelf/` does not interprete directory as alternative to `--path` #592

Closed TobiasKadelka closed 3 months ago

TobiasKadelka commented 4 months ago

-> All commands should interprete the usage of a key "directory" the same.


Here a scenario where I find the behavior un-intuitive and wrong:

❱ ls warehouse 
headphones_JBL_pro.325gtt      laptop_apple_macbookpro.0io4ff laptop_lenovo_thinkpad.iu7h6d
laptop_apple_macbook.9r5qlk    laptop_apple_macbookpro.1eic93

❱ onyo get --match type=laptop directory=warehouse -H 
# prints nothing (because directory is not a key inside the asset?)

❱ onyo get --match type=laptop --path warehouse -H                                                                          130 !
laptop  apple   macbook 9r5qlk  warehouse/laptop_apple_macbook.9r5qlk
laptop  apple   macbookpro  0io4ff  warehouse/laptop_apple_macbookpro.0io4ff
laptop  apple   macbookpro  1eic93  warehouse/laptop_apple_macbookpro.1eic93
laptop  lenovo  thinkpad    iu7h6d  warehouse/laptop_lenovo_thinkpad.iu7h6d
aqw commented 4 months ago

Part of this is resolved now that #603 is merged.

IMO, directory should not be an alternative to path. It should be the parent directory of the asset (which is how it is used in onyo new).

The proposal is for directory to be promoted form a Reserved Key (only used by new) to a Pseudo Key that's queryable like any other key.