pimterry / notes

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

notes should ignore files in hidden directories #61

Open tpikonen opened 6 years ago

tpikonen commented 6 years ago

I sync my notes with syncthing, so I sometimes get copies of my files under notes/.stversions, which show up when doing 'notes grep' etc.

notes should ignore files which are under directories starting with a '.', or at least there should be a configuration option for that. An ignore file would perhaps be even better.

rmNULL commented 6 years ago

This should be easy to implement if we use the grep provided on a GNU/Linux install. But that flag is not POSIX compatible, what do you guys think?

@pimterry @primis

primis commented 4 years ago

As @rmNULL has pointed out, --exclude-dir is not POSIX compatible, and therefore should not be used. There are however ways to do this "posixly correct". I think it'd be a good addition

eshapard commented 3 years ago

would piping through grep -v "/[.]" work? That should remove any path with '/.' in it, which should filter out hidden files, and hidden directories (and their contents).

I think you can add that to the initial grep statement in the grep_notes function.

local grep_output=$(grep -r "$notes_dir" -li -e "$*" 2>&1 | grep -v "/[.]")

I haven't tried this, myself.