psyinfra / onyo

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

error message from `generate_demo_repo.sh` is non-explanatory #590

Open TobiasKadelka opened 4 months ago

TobiasKadelka commented 4 months ago

The demo script has some own checks (and error messages) for finding out if a directory is allowed to be an onyo repo or not -- which is bad. The errors of the demo script are less informative than the onyo-errors that already exist.

onyo init should just be run by the demo script with the path provided to the demo. When onyo init fails the error message of it should be printed. The demo should not try to do checks that onyo init does anyways.


As an example: when running the demo script to build a new demo repository I get this error:

❱ ./demo/generate_demo_repo.sh /Users/tkadelka/onyo 
'/Users/tkadelka/onyo' cannot be an onyo repo

This error is caused by leftovers that were not deleted by rm -rdf *:

tkadelka@bnbmac73 in ~/onyo on git:master!
❱ ls -lisaht
total 0
   247503 0 drwxr-xr-x+ 80 tkadelka  staff   2.5K Mar 12 09:37 ..
 51093267 0 drwxr-xr-x   6 tkadelka  staff   192B Mar 12 09:33 .
104750709 0 drwxr-xr-x  12 tkadelka  staff   384B Mar 11 09:10 .git
104750743 0 drwxr-xr-x   6 tkadelka  staff   192B Mar  8 11:43 .onyo
111409479 0 drwxr-xr-x   6 tkadelka  staff   192B Jan 30 14:05 .pytest_cache
109501527 0 -rw-r--r--   1 tkadelka  staff     0B Jan 11 15:43 .anchor