Giter Site home page Giter Site logo

Comments (5)

pimterry avatar pimterry commented on August 21, 2024

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 #9 too).

What do you think?

from notes.

arael avatar arael commented on August 21, 2024

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.

from notes.

pimterry avatar pimterry commented on August 21, 2024

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

from notes.

arael avatar arael commented on August 21, 2024

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.

from notes.

pimterry avatar pimterry commented on August 21, 2024

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!

from notes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.