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

Add zettel title to pyzet grep output #24

Closed
tpwo opened this issue Apr 3, 2022 · 0 comments
Closed

Add zettel title to pyzet grep output #24

tpwo opened this issue Apr 3, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@tpwo
Copy link
Owner

tpwo commented Apr 3, 2022

It is possible by using some git grep flags:

$ git -C 'testing/zet/zettels' grep -Ii --heading --break --all-match -e '^#\s.*' --or -e 'hello'
20211016205158/README.md
# Zet test entry
Hello there!

20211016223643/README.md
# Another zet test entry
Hello everyone

^#\s.* symbolizes the zettel title. --or is used to provide git grep with multiple patterns, and --all-match has to be used, because otherwise all zettels would be matched (because every zettel contains a title).

The side effect of this approach is the fact that the first line is colored as matched (i.e. full red), but I don't see another way without messing with git grep output in Python, which I'd like to avoid.

Because of that, this should be rather an optional flag rather than a normal behavior.

@tpwo tpwo added the enhancement New feature or request label Apr 3, 2022
@tpwo tpwo closed this as completed in ad40a26 Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant