pimterry / notes

:pencil: Simple delightful note taking, with more unix and less lock-in.
https://github.com/pimterry/notes
MIT License
1.26k stars 82 forks source link

Fix recursive remove with no arguments deleting entire notes directory #48

Closed Chris-Robertson closed 6 years ago

Chris-Robertson commented 6 years ago

I discovered that calling note rm -r or note rm --recursive without passing a file or folder will recursively delete the entire notes directory (mine were backed up, of course).

This fix just adds a simple check to see if there is an argument passed. Very similar to the checks already used in the grep and cat functions.

The tests were failing on MacOS as rm --recursive isn't supported, so I added a check when creating the recursive flag.

I added further tests for the above recursive remove fix.

I also snuck in a tiny fix to handle directory names with spaces (thanks, Google Drive).

pimterry commented 6 years ago

Looks great, thanks! Merged