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 to output all metadata from search? #84

Open
daniels opened this issue Nov 3, 2018 · 3 comments
Open

Option to output all metadata from search? #84

daniels opened this issue Nov 3, 2018 · 3 comments
Labels
feature-request Feature Request

Comments

@daniels
Copy link

daniels commented Nov 3, 2018

Would it be possible to allow for optional output of the complete metadata in a structured format for the selected snippets after searching? (Personally I would prefer JSON for interoperability, but I guess TOML would be more in line with the project.)

I've just recently found and tried your tool and find it really nice to use. Besides a fast and nice fuzzy search, one thing I was hoping for when I started searching for a snippet manager was the ability to easily share snippets as nicely formatted markdown. The Gist-sync in pet is certainly useful, but maybe not for publishing.

If I could get complete output from search in a structured format, I could use pet in a pipeline where I implement the formatting myself.

@daniels
Copy link
Author

daniels commented Nov 4, 2018

I have looked at both fzf and peco now, and they both seem to allow for something like this, but each does it differently. I guess that makes it non-trivial to implement this with pluggable selectors.

For reference, here is what I found:

  • Fzf has a --with-nth flag for specifying fields (by index) to display/search, hiding all other fields while still passing them through as output.
  • Peco has a flag --null that allows a NUL-character to separate what is displayed/searched from what is output

@RamiAwar
Copy link
Collaborator

Hey @daniels, I think this can be a nice addition to the project!

Are you still interested in doing this? I'm down to help, I think easy sharing of snippets would be a nice new direction to explore with Pet.

@RamiAwar
Copy link
Collaborator

RamiAwar commented Feb 26, 2024

Also saw your other issue about adding the "format" of the snippet. I think this fits more into some generic metadata field. People might ask for storing more and more kinds of things in each snippet.

I want to try and avoid having to create any breaking changes in the saved snippet metadata, so I would want to go generic with this even for the MVP. What we can do is add a field called metadata that's structured, and has one subfield called format.

The thing is though, how many formats are you going to have realistically if you're using Pet? It's mostly "command line" snippets, not code snippets (like what https://github.com/maaslalani/nap does). It's probably just gonna be 'sh' :D But we have to also support windows so I'm still down to do this.

@RamiAwar RamiAwar added the feature-request Feature Request label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Feature Request
Projects
Status: Todo
Development

No branches or pull requests

2 participants