Skip to content

Commit

Permalink
expand_depth -> json_expand_depth
Browse files Browse the repository at this point in the history
  • Loading branch information
ynqa committed Apr 21, 2024
1 parent c6d16f2 commit b37d415
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/jnv.rs
Expand Up @@ -95,7 +95,7 @@ pub struct Jnv {
// Store the filter suggestions
suggest: Suggest,

expand_depth: Option<usize>,
json_expand_depth: Option<usize>,
no_hint: bool,
}

Expand All @@ -105,7 +105,7 @@ impl Jnv {
filter_editor: text_editor::State,
hint_message: text::State,
suggestions: listbox::State,
expand_depth: Option<usize>,
json_expand_depth: Option<usize>,
no_hint: bool,
indent: usize,
) -> Result<Prompt<Self>> {
Expand Down Expand Up @@ -154,7 +154,7 @@ impl Jnv {
hint_message: Snapshot::<text::State>::new(hint_message),
suggestions,
json: json::State {
stream: JsonStream::new(input_stream.clone(), expand_depth),
stream: JsonStream::new(input_stream.clone(), json_expand_depth),
theme: json::Theme {
curly_brackets_style: StyleBuilder::new()
.attrs(Attributes::from(Attribute::Bold))
Expand All @@ -175,7 +175,7 @@ impl Jnv {
},
trie,
suggest,
expand_depth,
json_expand_depth,
no_hint,
input_stream,
},
Expand Down Expand Up @@ -237,7 +237,7 @@ impl promkit::Renderer for Jnv {

match self.trie.exact_search(&filter) {
Some(jsonl) => {
self.json.stream = JsonStream::new(jsonl.clone(), self.expand_depth);
self.json.stream = JsonStream::new(jsonl.clone(), self.json_expand_depth);
self.update_hint_message(
format!(
"JSON query ('{}') was already executed. Result was retrieved from cache.",
Expand Down Expand Up @@ -265,13 +265,13 @@ impl promkit::Renderer for Jnv {
);
if let Some(searched) = self.trie.prefix_search(&filter) {
self.json.stream =
JsonStream::new(searched.clone(), self.expand_depth);
JsonStream::new(searched.clone(), self.json_expand_depth);
}
} else {
match deserialize_json(&ret.join("\n")) {
Ok(jsonl) => {
let stream =
JsonStream::new(jsonl.clone(), self.expand_depth);
JsonStream::new(jsonl.clone(), self.json_expand_depth);

let is_null = stream.roots().iter().all(|node| {
node == &JsonNode::Leaf(serde_json::Value::Null)
Expand All @@ -288,7 +288,7 @@ impl promkit::Renderer for Jnv {
{
self.json.stream = JsonStream::new(
searched.clone(),
self.expand_depth,
self.json_expand_depth,
);
}
} else {
Expand All @@ -311,7 +311,7 @@ impl promkit::Renderer for Jnv {
if let Some(searched) = self.trie.prefix_search(&filter) {
self.json.stream = JsonStream::new(
searched.clone(),
self.expand_depth,
self.json_expand_depth,
);
}
}
Expand All @@ -328,7 +328,7 @@ impl promkit::Renderer for Jnv {
);
if let Some(searched) = self.trie.prefix_search(&filter) {
self.json.stream =
JsonStream::new(searched.clone(), self.expand_depth);
JsonStream::new(searched.clone(), self.json_expand_depth);
}
return signal;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Expand Up @@ -97,7 +97,7 @@ pub struct Args {
Note: Increasing this depth can significantly slow down the display for large datasets.
"
)]
pub expand_depth: Option<usize>,
pub json_expand_depth: Option<usize>,

#[arg(
short = 'l',
Expand Down Expand Up @@ -188,7 +188,7 @@ fn main() -> Result<()> {
filter_editor,
hint_message,
suggestions,
args.expand_depth,
args.json_expand_depth,
args.no_hint,
args.indent,
)?;
Expand Down

0 comments on commit b37d415

Please sign in to comment.