Jqp: TUI Playground to Experiment with Jq

TribeNews
3 Min Read

jqp

a TUI playground for exploring jq.

- Advertisement -

This application utilizes itchyny’s implementation of jq written in Go, gojq.

Installation

- Advertisement -

homebrew

brew install noahgorstein/tap/jqp
macports

- Advertisement -

Arch Linux

Available through the Arch User Repository as jqp-bin.

Snap install

- Advertisement -

GitHub releases

Download the relevant asset for your operating system from the latest GitHub release. Unpack it, then move the binary to somewhere accessible in your PATH, e.g. mv ./jqp /usr/local/bin.

Build from source

- Advertisement -

Clone this repository, build from source with cd jqp && go build, then move the binary to somewhere accessible in your PATH, e.g. mv ./jqp /usr/local/bin.

Usage

āžœ jqp –help
jqp is a terminal user interface (TUI) for exploring the jq command line utility.

You can use it to run jq queries interactively. If no query is provided, the interface will prompt you for one.

The command accepts an optional query argument which will be executed against the input JSON or newline-delimited JSON (NDJSON).
You can provide the input JSON or NDJSON either through a file or via standard input (stdin).

Usage:
jqp [query] [flags]

Flags:
–config string path to config file (default is $HOME/.jqp.yaml)
-f, –file string path to the input JSON file
-h, –help help for jqp
-t, –theme string jqp theme
-v, –version version for jqp

jqp also supports input from STDIN. STDIN takes precedence over the command-line flag. Additionally, you can pass an optional query argument to jqp that it will execute upon loading.

āžœ curl ā€œhttps://api.github.com/repos/jqlang/jq/issuesā€ | jqp ā€˜.[] | {ā€œtitleā€: .title, ā€œurlā€: .url}’

Keybindings

Keybinding
Action

tab
cycle through sections

shift-tab
cycle through sections in reverse

ctrl-y
copy query to system clipboard1

ctrl-s
save output to file (copy to clipboard if file not specified)

ctrl-c
quit program / kill long-running query

Query Mode

Keybinding
Action

enter
execute query

↑/↓
cycle through query history

ctrl-a
go to beginning of line

ctrl-e
go to end of line

←/ctrl-b
move cursor one character to left

→/ctrl-f
move cursor one character to right

ctrl-k
delete text after cursor line

ctrl-u
delete text before cursor

ctrl-w
delete word to left

ctrl-d
delete character under cursor

Input Preview and Output Mode

Keybinding
Action

↑/k
up

↓/j
down

ctrl-u
page up

ctrl-d
page down

Configuration

jqp can be configured with a configuration file. By default, jqp will search your home directory for a YAML file named .jqp.yaml. A path to a YAML configuration file can also be provided to the –config command-line flag.

āžœ jqp –config ~/my_jqp_config.yaml

Leave a Comment
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected & This Is Prohibited!!!

We have detected that you are using extensions to block ads and you are also not using our official app. Your Account Have been Flagged and reported, pending de-activation & All your earning will be wiped out. Please turn off the software to continue

You cannot copy content of this app