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

Add option to read json from selected text or buffer #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions counsel-jq.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
(with-current-buffer
;; The user entered the `counsel-jq` query in the minibuffer.
;; This expression uses the most recent buffer ivy-read was
;; invoked from.
;; invoked from - either selected json region or whole buffer.
(ivy-state-buffer ivy-last)
(call-process-region
(point-min)
(point-max)
(if (region-active-p) (region-beginning) (point-min))
(if (region-active-p) (region-end) (point-max))
counsel-jq-command
nil
counsel-jq-buffer
Expand All @@ -57,7 +57,8 @@
(defun counsel-jq ()
"Counsel interface for dynamically querying jq.
Whenever you're happy with the query, hit RET and the results
will be displayed to you in the buffer in `counsel-jq-buffer'."
will be displayed to you in the buffer in `counsel-jq-buffer'.
JSON is read from selected json region or whole buffer."
(interactive)
(ivy-read "jq query: " #'counsel-jq-query-function
:action #'(1
Expand Down