Skip to content

Commit 5db327b

Browse files
authored
Merge pull request #67 from ynqa/v0.5.0/dev
v0.5.0: Async has arrived in `jnv`
2 parents 38caa3a + d64d60c commit 5db327b

16 files changed

+1927
-923
lines changed

Cargo.lock

+268-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "jnv"
3-
version = "0.4.2"
3+
version = "0.5.0"
44
authors = ["ynqa <[email protected]>"]
55
edition = "2021"
66
description = "JSON navigator and interactive filter leveraging jq"
@@ -9,15 +9,21 @@ license = "MIT"
99
readme = "README.md"
1010

1111
[dependencies]
12-
anyhow = "1.0.82"
13-
clap = { version = "4.5.4", features = ["derive"] }
14-
arboard = "3.4.0"
12+
anyhow = "1.0.95"
13+
arboard = "3.4.1"
14+
async-trait = "0.1.83"
15+
clap = { version = "4.5.23", features = ["derive"] }
16+
# See https://github.com/crossterm-rs/crossterm/issues/935
17+
crossterm = { version = "0.28.1", features = ["use-dev-tty", "event-stream", "libc"] }
18+
futures = "0.3.30"
19+
futures-timer = "3.0.3"
1520
jaq-core = "1.2.1"
1621
jaq-interpret = "1.2.1"
1722
jaq-parse = "1.0.2"
1823
jaq-std = "1.2.1"
19-
promkit = "0.6.0"
20-
radix_trie = "0.2.1"
24+
promkit = "0.6.2"
25+
tokio = { version = "1.42.0", features = ["full"] }
26+
tokio-stream = "0.1.16"
2127

2228
# The profile that 'cargo dist' will build with
2329
[profile.dist]

README.md

+50-40
Original file line numberDiff line numberDiff line change
@@ -123,34 +123,53 @@ jnv data.json
123123

124124
## Keymap
125125

126-
| Key | Action
127-
| :- | :-
128-
| <kbd>Ctrl + C</kbd> | Exit `jnv`
129-
| <kbd>Tab</kbd> | jq filter auto-completion
130-
| <kbd>←</kbd> | Move the cursor one character to the left
131-
| <kbd>→</kbd> | Move the cursor one character to the right
132-
| <kbd>Ctrl + A</kbd> | Move the cursor to the start of the filter
133-
| <kbd>Ctrl + E</kbd> | Move the cursor to the end of the filter
134-
| <kbd>Backspace</kbd> | Delete a character of filter at the cursor position
135-
| <kbd>Ctrl + U</kbd> | Delete all characters of filter
136-
| <kbd>↑</kbd>, <kbd>Ctrl + K</kbd> | Move the cursor one entry up in JSON viewer
137-
| <kbd>↓</kbd>, <kbd>Ctrl + J</kbd> | Move the cursor one entry down in JSON viewer
138-
| <kbd>Ctrl + H</kbd> | Move to the last entry in JSON viewer
139-
| <kbd>Ctrl + L</kbd> | Move to the first entry in JSON viewer
140-
| <kbd>Enter</kbd> | Toggle expand/collapse in JSON viewer
141-
| <kbd>Ctrl + P</kbd> | Expand all folds in JSON viewer
142-
| <kbd>Ctrl + N</kbd> | Collapse all folds in JSON viewer
143-
| <kbd>Alt + B</kbd> | Move the cursor to the previous nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`)
144-
| <kbd>Alt + F</kbd> | Move the cursor to the next nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`)
145-
| <kbd>Ctrl + W</kbd> | Erase to the previous nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`)
146-
| <kbd>Alt + D</kbd> | Erase to the next nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`)
147-
| <kbd>Ctrl + O</kbd> | Copy current JSON content to clipboard
148-
| <kbd>Ctrl + Q</kbd> | Copy current query to clipboard
126+
| Key | Action |
127+
| :- | :- |
128+
| <kbd>Ctrl + C</kbd> | Exit |
129+
| <kbd>Ctrl + Q</kbd> | Copy jq filter to clipboard |
130+
| <kbd>Ctrl + O</kbd> | Copy JSON to clipboard |
131+
| <kbd>Shift + ↑</kbd>, <kbd>Shift + ↓</kbd> | Switch to another mode |
132+
133+
### Editor mode (default)
134+
135+
| Key | Action |
136+
| :- | :- |
137+
| <kbd>Tab</kbd> | Enter suggestion |
138+
| <kbd>←</kbd> | Move cursor left |
139+
| <kbd>→</kbd> | Move cursor right |
140+
| <kbd>Ctrl + A</kbd> | Move cursor to line start |
141+
| <kbd>Ctrl + E</kbd> | Move cursor to line end |
142+
| <kbd>Backspace</kbd> | Delete character before cursor |
143+
| <kbd>Ctrl + U</kbd> | Clear entire line |
144+
| <kbd>Alt + B</kbd> | Move the cursor to the previous nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`) |
145+
| <kbd>Alt + F</kbd> | Move the cursor to the next nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`) |
146+
| <kbd>Ctrl + W</kbd> | Erase to the previous nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`) |
147+
| <kbd>Alt + D</kbd> | Erase to the next nearest character within set(`.`,`\|`,`(`,`)`,`[`,`]`) |
148+
149+
#### Suggestion in Editor (after <kbd>Tab</kbd>)
150+
151+
| Key | Action |
152+
| :- | :- |
153+
| <kbd>Tab</kbd>, <kbd>↓</kbd> | Select next suggestion |
154+
| <kbd>↑</kbd> | Select previous suggestion |
155+
| Others | Return to editor |
156+
157+
### JSON viewer mode
158+
159+
| Key | Action |
160+
| :- | :- |
161+
| <kbd>↑</kbd>, <kbd>Ctrl + K</kbd> | Move up |
162+
| <kbd>↓</kbd>, <kbd>Ctrl + J</kbd> | Move down |
163+
| <kbd>Ctrl + H</kbd> | Move to last entry |
164+
| <kbd>Ctrl + L</kbd> | Move to first entry |
165+
| <kbd>Enter</kbd> | Toggle fold |
166+
| <kbd>Ctrl + P</kbd> | Expand all |
167+
| <kbd>Ctrl + N</kbd> | Collapse all |
149168

150169
## Usage
151170

152171
```bash
153-
JSON navigator and interactive filter leveraging jq
172+
SON navigator and interactive filter leveraging jq
154173

155174
Usage: jnv [OPTIONS] [INPUT]
156175

@@ -165,22 +184,13 @@ Arguments:
165184
[INPUT] Optional path to a JSON file. If not provided or if "-" is specified, reads from standard input
166185

167186
Options:
168-
-e, --edit-mode <EDIT_MODE>
169-
Edit mode for the interface ('insert' or 'overwrite'). [default: insert]
170-
-i, --indent <INDENT>
171-
Number of spaces used for indentation in the visualized data. [default: 2]
172-
-n, --no-hint
173-
Disables the display of hints.
174-
-d, --expand-depth <JSON_EXPAND_DEPTH>
175-
Initial depth to which JSON nodes are expanded in the visualization. [default: 3]
176-
-s, --limit-length <JSON_LIMIT_LENGTH>
177-
Limit length of JSON array in the visualization. [default: 50]
178-
-l, --suggestion-list-length <SUGGESTION_LIST_LENGTH>
179-
Number of suggestions visible in the list. [default: 3]
180-
-h, --help
181-
Print help (see more with '--help')
182-
-V, --version
183-
Print version
187+
-e, --edit-mode <EDIT_MODE> Edit mode for the interface ('insert' or 'overwrite'). [default: insert]
188+
-i, --indent <INDENT> Number of spaces used for indentation in the visualized data. [default: 2]
189+
-n, --no-hint Disables the display of hints.
190+
--max-streams <MAX_STREAMS> Maximum number of JSON streams to display
191+
--suggestions <SUGGESTIONS> Number of autocomplete suggestions to show [default: 3]
192+
-h, --help Print help (see more with '--help')
193+
-V, --version Print version
184194
```
185195
186196
## Stargazers over time

0 commit comments

Comments
 (0)