refactor: extract json_display
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
use std::{
|
||||
io::stdout,
|
||||
sync::{
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
},
|
||||
use std::sync::{
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
};
|
||||
|
||||
use nyquest_preset::nyquest::ClientBuilder;
|
||||
@@ -28,7 +25,7 @@ use spdlog::{error, info, warn};
|
||||
|
||||
use crate::{
|
||||
commands::Cli,
|
||||
utils::{human_readable_display, login_action},
|
||||
utils::{human_readable_display, json_display, login_action},
|
||||
};
|
||||
|
||||
#[cfg(feature = "fetchall")]
|
||||
@@ -139,8 +136,7 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
}
|
||||
|
||||
if !human_readable {
|
||||
let lock = stdout().lock();
|
||||
serde_json::to_writer_pretty(lock, &resp)?;
|
||||
json_display(resp)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user