pimterry/notes

notes should ignore files in hidden directories

tpikonen opened this issue · 3 comments

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.

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

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

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.