noahgorstein / jqp

A TUI playground to experiment with jq
MIT License
2.19k stars 40 forks source link

Feature request: Hotkey to save the query itself in the clipboard #1

Closed emilebosch closed 2 years ago

emilebosch commented 2 years ago

Would be nice to have a hotkey to save the query in the clipboard, so I can use it in my scripts. Maybe one with the full (escaped) command, and one with just the query.

noahgorstein commented 2 years ago

Thanks for the request! Great idea and similar to what I was thinking of trying to implement next.

emilebosch commented 2 years ago

💯 great work! thank you!

joshgantt commented 2 years ago

Came here looking for this as it would fit my use-case perfectly. I frequently use jq against large kube output, and my shell history is littered with repetitive "guess and check"-style iteration to get my query right before utilizing in a script or report, which makes it quite difficult to visually parse what is functional, useful jq for reuse vs. iterative failures. I think adding this "query to clipboard" keybinding would be great!

noahgorstein commented 2 years ago

Thanks for detailing that @joshgantt. Great to hear how folks are using the tool in their workflows. Think I found a way to get this in easily with https://github.com/atotto/clipboard. Going to try and do some additional testing but so far so good at least on my Mac.

noahgorstein commented 2 years ago

@emilebosch @joshgantt, I just merged some changes to main that should give you a ctrl+y keybinding to copy the query to your system clipboard if you want to test it yourselves before I cut a release.

joshgantt commented 2 years ago

Removed the package I originally got from the AUR and built main from source- works like a charm, thanks! (Edit to add: working on Arch Linux with xclip for clipboard interface)

noahgorstein commented 2 years ago

Awesome! Interesting, I don't actually use Linux as my daily driver but interesting to know that it's in the AUR registry. Curious to know how that happened haha 🤷‍♂️

emilebosch commented 2 years ago

Perfect! Did you also upgrade it in home-brew? Can't seem to upgrade here.

Warning: noahgorstein/tap/jqp 0.1.0 already installed

noahgorstein commented 2 years ago

Not yet, was trying to get more little improvements/fixes in but am most likely going to cut a release this weekend. home brew should be updated at that point.

noahgorstein commented 2 years ago

@emilebosch just pushed out v0.2.0 which is now available on homebrew as well.

emilebosch commented 2 years ago

Fantastic! It works, thank you!