Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notes should ignore files in hidden directories #61

Open
tpikonen opened this issue Apr 11, 2018 · 3 comments
Open

notes should ignore files in hidden directories #61

tpikonen opened this issue Apr 11, 2018 · 3 comments

Comments

@tpikonen
Copy link

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
Copy link
Contributor

rmNULL commented Apr 13, 2018

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
Copy link
Collaborator

primis commented Aug 26, 2019

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
Copy link
Contributor

eshapard commented Jun 7, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants