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

Option for use ripgrep instead of find in org-fc-awk--find #69

Open
mithraen opened this issue Oct 28, 2021 · 2 comments · May be fixed by #78
Open

Option for use ripgrep instead of find in org-fc-awk--find #69

mithraen opened this issue Oct 28, 2021 · 2 comments · May be fixed by #78

Comments

@mithraen
Copy link
Contributor

When use org-fc in directory when files with flashcards mixed with files without flash cards, with ripgrep instead of file

It can be done like this:

(defun org-fc-awk--find (paths)
  "Generate shell code to search PATHS for org files.
Matches all .org files ignoring ones with names don't start with
a '.' to exclude temporary / backup files.
With the '-L' option, 'find' follows symlinks."
  (format
   (if
       org-fc-use-ripgrep
       "rg ^:REVIEW_DATA: -L %s -g \"*.org\" -l -0"
       "find -L %s -name \"*.org\" -not -name \".*\" -print0")
   (mapconcat
    (lambda (path) (shell-quote-argument (expand-file-name path)))
    paths " ")))
@l3kn
Copy link
Owner

l3kn commented Nov 3, 2021

Searching only for files containing flashcards is a great idea, maybe a org-fc-find-command variable would be more flexible?

@mithraen
Copy link
Contributor Author

mithraen commented Nov 3, 2021

Yes, it would be better solution. Maybe with sample in documentation for 'find + grep' and 'ripgrep'.

I prefer ripgrep, but find + xargs + grep works fast enough.

Maybe set default for this variable to something like:

find -L . -name "*.org" -not -name ".*" -print0 | xargs -0r grep -lZ ^:REVIEW_DATA:

ja0nz added a commit to ja0nz/org-fc that referenced this issue Sep 7, 2022
ja0nz added a commit to ja0nz/org-fc that referenced this issue Sep 12, 2022
@ja0nz ja0nz linked a pull request Sep 12, 2022 that will close this issue
mithraen added a commit to mithraen/org-fc that referenced this issue Dec 19, 2023
mithraen added a commit to mithraen/org-fc that referenced this issue Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants