psyinfra / onyo

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

`onyo_tree` uses odd tuple for `dirs` #606

Open aqw opened 6 months ago

aqw commented 6 months ago

The onyo_tree function accepts a tuple (str, Path) for dirs.

This is in contrast to how other commands accept paths. The str is to show the user the directories they called, in the format they called it.

This avoids loads of complexities with relative vs absolute paths, and CWD that is not repo-root.

Questions are (non-exclusive of each other):

aqw commented 6 months ago

@bpoldrack @TobiasKadelka Not sure if I captured your suggestions/thoughts well here. Please add them to help clarify what you two see.

bpoldrack commented 6 months ago

Registering the idea of PathParameter class, that allows to capture that sort of annotation (currently description). onyo_XXX could potentially accept both Path or PathParameter. Constructor would take a Path and an optional annotation (implementing a default ofc). This class could behave like a Path and only overwrite its __str__ to make use of the annotation. So, for any actual path operation code doesn't need to change and only when calling str() on it there would be an effect.