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

Allow searching by value #4

Open
SpicyLemon opened this issue Jul 8, 2021 · 4 comments
Open

Allow searching by value #4

SpicyLemon opened this issue Jul 8, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@SpicyLemon
Copy link
Owner

SpicyLemon commented Jul 8, 2021

Feature Request: Add ability to find entries by value while using json_explorer.

@SpicyLemon SpicyLemon added the enhancement New feature or request label Jul 8, 2021
@SpicyLemon
Copy link
Owner Author

My initial thought here is to include the value in the line for entries that are null, text, or numbers (or are not arrays or objects).

That might run into issues with longer entries, though, so some research is needed.

Other options:

  • Provide the search value during CLI invocation.
  • Provide another shell function that does the searching (and provide an easy way to hook that into the json-explorer fzf stuff).

@SpicyLemon SpicyLemon self-assigned this Jul 9, 2021
@SpicyLemon
Copy link
Owner Author

Here's my plan right now:

  1. Create a new shell function/script that will return paths based on a jq test(val) search.
  2. Provide a key binding in the json_explorer fzf setup that will provide the current query as the val and update the query with the results.

There's a small hiccup, though. Currently, fzf doesn't have a way to update the query based on the results of a command execution. I found a ticket for it though: junegunn/fzf#2465 and created a PR for it: junegunn/fzf#2559
But I don't know when it'll get any attention.

So for now, I'll at least create the search function/script.

@SpicyLemon SpicyLemon removed their assignment Jul 19, 2021
@SpicyLemon
Copy link
Owner Author

Issue #7 created for part 1 of my plan above.

@SpicyLemon
Copy link
Owner Author

I have some thoughts on this now that json_search is ready and some performance issues have been addressed in json_info.

For this, we'll want some key-binding in fzf for various actions. Here's what I'm thinking:
ctrl-f = find: will call json_search -q {} -f $filename --hide-values then transform it into a " | " delimited list.
ctrl-F = find (ignore case): will call json_search -q {} --flags i -f $filename --hide-values then transform it into a " | " delimited list.
ctrl-t = this: will change the query to the currently selected item.
ctrl-x = clear the query.

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