Skip to content
New issue

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

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

Already on GitHub? # to your account

Feature Request: notes grep should show the notes content entries #8

Closed
arael opened this issue Dec 2, 2016 · 5 comments
Closed

Feature Request: notes grep should show the notes content entries #8

arael opened this issue Dec 2, 2016 · 5 comments

Comments

@arael
Copy link

arael commented Dec 2, 2016

I think that notes grep command should not only list the notes title but also show the lines where the pattern has been found.

@pimterry
Copy link
Owner

pimterry commented Dec 2, 2016

I'd like to do that, but it's slightly tricky since it's useful to be able to pipe the matched filenames elsewhere (notes grep <pattern> | notes open). I think there's two options:

  • Add a --show-matches option to do this
  • Detect whether your output is going to a pipe or a tty, and show more or less detail based on that (as discussed on Feature Request: notes cat command #9 too).

What do you think?

@arael
Copy link
Author

arael commented Dec 2, 2016

I see. Perhaps we could use a different command such as notes cgrep or notes lines.
I think the --show-matches is too long but it would avoid having a new command.

@pimterry
Copy link
Owner

pimterry commented Dec 2, 2016

What about the 2nd option? If notes grep normally printed output that including matching details, but didn't included those details when piped, would that work for you?

E.g. like this:

> notes grep <pattern>
my-note.md:
blah blah blah *matching text* blah blah
another-note.md:
more *matching text* blah blah
> notes grep <pattern> | cat
my-note.md
another-note.md

@arael
Copy link
Author

arael commented Dec 2, 2016

That would be very handy. But I am afraid the users would expect the pipe to contain the content as well and not only the file list.

@pimterry
Copy link
Owner

pimterry commented Dec 6, 2016

I've opened a new ticket (#22) tracking the underlying issue here: we need a way to get snippets of any set of notes that doesn't break piping. I'm going to close this and track it over there - feel free to add your opinions there, or start looking at implementation options. Thanks for getting involved!

@pimterry pimterry closed this as completed Dec 6, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants