refactor: unify status data generation and output formatting
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -25,7 +25,7 @@ use tower_http::trace::TraceLayer;
|
|||||||
use crate::compression_engine::{CompressionType, get_compression_engine};
|
use crate::compression_engine::{CompressionType, get_compression_engine};
|
||||||
use crate::db;
|
use crate::db;
|
||||||
use crate::Args;
|
use crate::Args;
|
||||||
use crate::modes::status::{PathInfo, CompressionInfo, MetaPluginInfo, StatusInfo};
|
use crate::modes::status::{StatusInfo, generate_status_info};
|
||||||
use crate::compression_engine::{CompressionType as CompressionTypeEnum, COMPRESSION_PROGRAMS};
|
use crate::compression_engine::{CompressionType as CompressionTypeEnum, COMPRESSION_PROGRAMS};
|
||||||
use crate::compression_engine::program::CompressionEngineProgram;
|
use crate::compression_engine::program::CompressionEngineProgram;
|
||||||
use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
|
use crate::meta_plugin::{MetaPluginType, get_meta_plugin};
|
||||||
@@ -220,89 +220,7 @@ async fn handle_status(
|
|||||||
let mut db_path = state.data_dir.clone();
|
let mut db_path = state.data_dir.clone();
|
||||||
db_path.push("keep-1.db");
|
db_path.push("keep-1.db");
|
||||||
|
|
||||||
let path_info = PathInfo {
|
let status_info = generate_status_info(state.data_dir.clone(), db_path, &meta_plugin_types);
|
||||||
data: state.data_dir.to_string_lossy().to_string(),
|
|
||||||
database: db_path.to_string_lossy().to_string(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let default_type = crate::compression_engine::default_compression_type();
|
|
||||||
let mut compression_info = Vec::new();
|
|
||||||
|
|
||||||
// Sort compression types by their string representation
|
|
||||||
let mut sorted_compression_types: Vec<CompressionTypeEnum> = CompressionTypeEnum::iter().collect();
|
|
||||||
sorted_compression_types.sort_by_key(|ct| ct.to_string());
|
|
||||||
|
|
||||||
for compression_type in sorted_compression_types {
|
|
||||||
let compression_program: CompressionEngineProgram =
|
|
||||||
match &COMPRESSION_PROGRAMS[compression_type.clone()] {
|
|
||||||
Some(compression_program) => compression_program.clone(),
|
|
||||||
None => CompressionEngineProgram {
|
|
||||||
program: "".to_string(),
|
|
||||||
compress: Vec::new(),
|
|
||||||
decompress: Vec::new(),
|
|
||||||
supported: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let is_default = compression_type == default_type;
|
|
||||||
let binary = if compression_program.program.is_empty() {
|
|
||||||
"<INTERNAL>".to_string()
|
|
||||||
} else {
|
|
||||||
compression_program.program
|
|
||||||
};
|
|
||||||
|
|
||||||
compression_info.push(CompressionInfo {
|
|
||||||
compression_type: compression_type.to_string(),
|
|
||||||
found: compression_program.supported,
|
|
||||||
default: is_default,
|
|
||||||
binary,
|
|
||||||
compress: compression_program.compress.join(" "),
|
|
||||||
decompress: compression_program.decompress.join(" "),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut meta_plugin_info = Vec::new();
|
|
||||||
|
|
||||||
// Sort meta plugin types by their meta name
|
|
||||||
let mut sorted_meta_plugins: Vec<MetaPluginType> = MetaPluginType::iter().collect();
|
|
||||||
sorted_meta_plugins.sort_by_key(|meta_plugin_type| {
|
|
||||||
let mut meta_plugin = get_meta_plugin(meta_plugin_type.clone());
|
|
||||||
meta_plugin.meta_name()
|
|
||||||
});
|
|
||||||
|
|
||||||
for meta_plugin_type in sorted_meta_plugins {
|
|
||||||
let mut meta_plugin = get_meta_plugin(meta_plugin_type.clone());
|
|
||||||
let is_supported = meta_plugin.is_supported();
|
|
||||||
let is_enabled = meta_plugin_types.contains(&meta_plugin_type);
|
|
||||||
|
|
||||||
let (binary_display, args_display) = if !is_supported {
|
|
||||||
("<NOT FOUND>".to_string(), "".to_string())
|
|
||||||
} else {
|
|
||||||
if meta_plugin.is_internal() {
|
|
||||||
("<INTERNAL>".to_string(), "".to_string())
|
|
||||||
} else {
|
|
||||||
if let Some((program, args)) = meta_plugin.program_info() {
|
|
||||||
(program.to_string(), args.join(" "))
|
|
||||||
} else {
|
|
||||||
("<NOT FOUND>".to_string(), "".to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
meta_plugin_info.push(MetaPluginInfo {
|
|
||||||
meta_name: meta_plugin.meta_name(),
|
|
||||||
found: is_supported,
|
|
||||||
enabled: is_enabled,
|
|
||||||
binary: binary_display,
|
|
||||||
args: args_display,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let status_info = StatusInfo {
|
|
||||||
paths: path_info,
|
|
||||||
compression: compression_info,
|
|
||||||
meta_plugins: meta_plugin_info,
|
|
||||||
};
|
|
||||||
|
|
||||||
let response = ApiResponse {
|
let response = ApiResponse {
|
||||||
success: true,
|
success: true,
|
||||||
|
|||||||
@@ -20,175 +20,44 @@ use prettytable::format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR;
|
|||||||
use crate::meta_plugin;
|
use crate::meta_plugin;
|
||||||
use crate::meta_plugin::MetaPluginType;
|
use crate::meta_plugin::MetaPluginType;
|
||||||
|
|
||||||
fn build_path_table(data_path: PathBuf, db_path: PathBuf) -> Table {
|
#[derive(Serialize, Deserialize)]
|
||||||
let mut path_table = Table::new();
|
pub struct StatusInfo {
|
||||||
|
pub paths: PathInfo,
|
||||||
if std::io::stdout().is_terminal() {
|
pub compression: Vec<CompressionInfo>,
|
||||||
path_table.set_format(get_format_box_chars_no_border_line_separator());
|
pub meta_plugins: Vec<MetaPluginInfo>,
|
||||||
} else {
|
|
||||||
path_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
path_table.set_titles(Row::new(vec![
|
#[derive(Serialize, Deserialize)]
|
||||||
Cell::new("Type").with_style(Attr::Bold),
|
pub struct PathInfo {
|
||||||
Cell::new("Path").with_style(Attr::Bold),
|
pub data: String,
|
||||||
]));
|
pub database: String,
|
||||||
|
|
||||||
path_table.add_row(Row::new(vec![
|
|
||||||
Cell::new("Data"),
|
|
||||||
Cell::new(
|
|
||||||
&data_path
|
|
||||||
.into_os_string()
|
|
||||||
.into_string()
|
|
||||||
.expect("Unable to convert data path to string"),
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
|
|
||||||
path_table.add_row(Row::new(vec![
|
|
||||||
Cell::new("Database"),
|
|
||||||
Cell::new(
|
|
||||||
&db_path
|
|
||||||
.into_os_string()
|
|
||||||
.into_string()
|
|
||||||
.expect("Unable to convert DB path to string"),
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
|
|
||||||
path_table
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_compression_table() -> Table {
|
#[derive(Serialize, Deserialize)]
|
||||||
let mut compression_table = Table::new();
|
pub struct CompressionInfo {
|
||||||
if std::io::stdout().is_terminal() {
|
#[serde(rename = "type")]
|
||||||
compression_table.set_format(get_format_box_chars_no_border_line_separator());
|
pub compression_type: String,
|
||||||
} else {
|
pub found: bool,
|
||||||
compression_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
pub default: bool,
|
||||||
|
pub binary: String,
|
||||||
|
pub compress: String,
|
||||||
|
pub decompress: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
compression_table.set_titles(row!(
|
#[derive(Serialize, Deserialize)]
|
||||||
b->"Type",
|
pub struct MetaPluginInfo {
|
||||||
b->"Found",
|
pub meta_name: String,
|
||||||
b->"Default",
|
pub found: bool,
|
||||||
b->"Binary",
|
pub enabled: bool,
|
||||||
b->"Compress",
|
pub binary: String,
|
||||||
b->"Decompress"));
|
pub args: String,
|
||||||
|
|
||||||
let default_type = compression_engine::default_compression_type();
|
|
||||||
|
|
||||||
// Sort compression types by their string representation
|
|
||||||
let mut sorted_compression_types: Vec<CompressionType> = CompressionType::iter().collect();
|
|
||||||
sorted_compression_types.sort_by_key(|ct| ct.to_string());
|
|
||||||
|
|
||||||
for compression_type in sorted_compression_types {
|
|
||||||
let compression_program: CompressionEngineProgram =
|
|
||||||
match &COMPRESSION_PROGRAMS[compression_type.clone()] {
|
|
||||||
Some(compression_program) => compression_program.clone(),
|
|
||||||
None => CompressionEngineProgram {
|
|
||||||
program: "".to_string(),
|
|
||||||
compress: Vec::new(),
|
|
||||||
decompress: Vec::new(),
|
|
||||||
supported: true,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let is_default = compression_type == default_type;
|
|
||||||
|
|
||||||
compression_table.add_row(Row::new(vec![
|
|
||||||
Cell::new(&compression_type.to_string()),
|
|
||||||
match compression_program.supported {
|
|
||||||
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
|
||||||
false => Cell::new("No").with_style(Attr::ForegroundColor(color::RED)),
|
|
||||||
},
|
|
||||||
match is_default {
|
|
||||||
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
|
||||||
false => Cell::new("No"),
|
|
||||||
},
|
|
||||||
match compression_program.program.is_empty() {
|
|
||||||
true => {
|
|
||||||
Cell::new("<INTERNAL>").with_style(Attr::ForegroundColor(color::BRIGHT_BLACK))
|
|
||||||
}
|
|
||||||
false => Cell::new(&compression_program.program),
|
|
||||||
},
|
|
||||||
Cell::new(&compression_program.compress.join(" ")),
|
|
||||||
Cell::new(&compression_program.decompress.join(" ")),
|
|
||||||
]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compression_table
|
fn generate_status_info(
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
fn build_meta_plugin_table(enabled_meta_plugins: &Vec<MetaPluginType>) -> Table {
|
|
||||||
let mut meta_plugin_table = Table::new();
|
|
||||||
if std::io::stdout().is_terminal() {
|
|
||||||
meta_plugin_table.set_format(get_format_box_chars_no_border_line_separator());
|
|
||||||
} else {
|
|
||||||
meta_plugin_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_plugin_table.set_titles(row!(
|
|
||||||
b->"Meta Name",
|
|
||||||
b->"Found",
|
|
||||||
b->"Enabled",
|
|
||||||
b->"Binary",
|
|
||||||
b->"Args"));
|
|
||||||
|
|
||||||
// Sort meta plugin types by their meta name
|
|
||||||
let mut sorted_meta_plugins: Vec<MetaPluginType> = MetaPluginType::iter().collect();
|
|
||||||
sorted_meta_plugins.sort_by_key(|meta_plugin_type| {
|
|
||||||
let mut meta_plugin = meta_plugin::get_meta_plugin(meta_plugin_type.clone());
|
|
||||||
meta_plugin.meta_name()
|
|
||||||
});
|
|
||||||
|
|
||||||
for meta_plugin_type in sorted_meta_plugins {
|
|
||||||
let mut meta_plugin = meta_plugin::get_meta_plugin(meta_plugin_type.clone());
|
|
||||||
let is_supported = meta_plugin.is_supported();
|
|
||||||
let is_enabled = enabled_meta_plugins.contains(&meta_plugin_type);
|
|
||||||
|
|
||||||
// Determine what implementation will actually be used
|
|
||||||
let (binary_display, args_display) = if !is_supported {
|
|
||||||
("<NOT FOUND>".to_string(), "".to_string())
|
|
||||||
} else {
|
|
||||||
if meta_plugin.is_internal() {
|
|
||||||
("<INTERNAL>".to_string(), "".to_string())
|
|
||||||
} else {
|
|
||||||
// Get program info from the meta plugin itself
|
|
||||||
if let Some((program, args)) = meta_plugin.program_info() {
|
|
||||||
(program.to_string(), args.join(" "))
|
|
||||||
} else {
|
|
||||||
("<NOT FOUND>".to_string(), "".to_string())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
meta_plugin_table.add_row(Row::new(vec![
|
|
||||||
Cell::new(&meta_plugin.meta_name()),
|
|
||||||
match is_supported {
|
|
||||||
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
|
||||||
false => Cell::new("No").with_style(Attr::ForegroundColor(color::RED)),
|
|
||||||
},
|
|
||||||
match is_enabled {
|
|
||||||
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
|
||||||
false => Cell::new("No"),
|
|
||||||
},
|
|
||||||
match binary_display.as_str() {
|
|
||||||
"<INTERNAL>" => Cell::new(&binary_display).with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
|
|
||||||
"<NOT FOUND>" => Cell::new(&binary_display).with_style(Attr::ForegroundColor(color::RED)),
|
|
||||||
_ => Cell::new(&binary_display),
|
|
||||||
},
|
|
||||||
Cell::new(&args_display),
|
|
||||||
]));
|
|
||||||
}
|
|
||||||
|
|
||||||
meta_plugin_table
|
|
||||||
}
|
|
||||||
|
|
||||||
fn show_status_structured(
|
|
||||||
data_path: PathBuf,
|
data_path: PathBuf,
|
||||||
db_path: PathBuf,
|
db_path: PathBuf,
|
||||||
enabled_meta_plugins: &Vec<MetaPluginType>,
|
enabled_meta_plugins: &Vec<MetaPluginType>,
|
||||||
output_format: OutputFormat,
|
) -> StatusInfo {
|
||||||
) -> Result<(), anyhow::Error> {
|
|
||||||
let path_info = PathInfo {
|
let path_info = PathInfo {
|
||||||
data: data_path.into_os_string().into_string().expect("Unable to convert data path to string"),
|
data: data_path.into_os_string().into_string().expect("Unable to convert data path to string"),
|
||||||
database: db_path.into_os_string().into_string().expect("Unable to convert DB path to string"),
|
database: db_path.into_os_string().into_string().expect("Unable to convert DB path to string"),
|
||||||
@@ -267,60 +136,116 @@ fn show_status_structured(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let status_info = StatusInfo {
|
StatusInfo {
|
||||||
paths: path_info,
|
paths: path_info,
|
||||||
compression: compression_info,
|
compression: compression_info,
|
||||||
meta_plugins: meta_plugin_info,
|
meta_plugins: meta_plugin_info,
|
||||||
};
|
|
||||||
|
|
||||||
match output_format {
|
|
||||||
OutputFormat::Json => {
|
|
||||||
println!("{}", serde_json::to_string_pretty(&status_info)?);
|
|
||||||
}
|
}
|
||||||
OutputFormat::Yaml => {
|
|
||||||
println!("{}", serde_yaml::to_string(&status_info)?);
|
|
||||||
}
|
|
||||||
OutputFormat::Table => unreachable!(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
fn build_path_table(path_info: &PathInfo) -> Table {
|
||||||
|
let mut path_table = Table::new();
|
||||||
|
|
||||||
|
if std::io::stdout().is_terminal() {
|
||||||
|
path_table.set_format(get_format_box_chars_no_border_line_separator());
|
||||||
|
} else {
|
||||||
|
path_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
path_table.set_titles(Row::new(vec![
|
||||||
pub struct StatusInfo {
|
Cell::new("Type").with_style(Attr::Bold),
|
||||||
pub paths: PathInfo,
|
Cell::new("Path").with_style(Attr::Bold),
|
||||||
pub compression: Vec<CompressionInfo>,
|
]));
|
||||||
pub meta_plugins: Vec<MetaPluginInfo>,
|
|
||||||
|
path_table.add_row(Row::new(vec![
|
||||||
|
Cell::new("Data"),
|
||||||
|
Cell::new(&path_info.data),
|
||||||
|
]));
|
||||||
|
|
||||||
|
path_table.add_row(Row::new(vec![
|
||||||
|
Cell::new("Database"),
|
||||||
|
Cell::new(&path_info.database),
|
||||||
|
]));
|
||||||
|
|
||||||
|
path_table
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
fn build_compression_table(compression_info: &Vec<CompressionInfo>) -> Table {
|
||||||
pub struct PathInfo {
|
let mut compression_table = Table::new();
|
||||||
pub data: String,
|
if std::io::stdout().is_terminal() {
|
||||||
pub database: String,
|
compression_table.set_format(get_format_box_chars_no_border_line_separator());
|
||||||
|
} else {
|
||||||
|
compression_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
compression_table.set_titles(row!(
|
||||||
pub struct CompressionInfo {
|
b->"Type",
|
||||||
#[serde(rename = "type")]
|
b->"Found",
|
||||||
pub compression_type: String,
|
b->"Default",
|
||||||
pub found: bool,
|
b->"Binary",
|
||||||
pub default: bool,
|
b->"Compress",
|
||||||
pub binary: String,
|
b->"Decompress"));
|
||||||
pub compress: String,
|
|
||||||
pub decompress: String,
|
for info in compression_info {
|
||||||
|
compression_table.add_row(Row::new(vec![
|
||||||
|
Cell::new(&info.compression_type),
|
||||||
|
match info.found {
|
||||||
|
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
||||||
|
false => Cell::new("No").with_style(Attr::ForegroundColor(color::RED)),
|
||||||
|
},
|
||||||
|
match info.default {
|
||||||
|
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
||||||
|
false => Cell::new("No"),
|
||||||
|
},
|
||||||
|
match info.binary.as_str() {
|
||||||
|
"<INTERNAL>" => Cell::new(&info.binary).with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
|
||||||
|
_ => Cell::new(&info.binary),
|
||||||
|
},
|
||||||
|
Cell::new(&info.compress),
|
||||||
|
Cell::new(&info.decompress),
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
compression_table
|
||||||
pub struct MetaPluginInfo {
|
|
||||||
pub meta_name: String,
|
|
||||||
pub found: bool,
|
|
||||||
pub enabled: bool,
|
|
||||||
pub binary: String,
|
|
||||||
pub args: String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn build_meta_plugin_table(meta_plugin_info: &Vec<MetaPluginInfo>) -> Table {
|
||||||
|
let mut meta_plugin_table = Table::new();
|
||||||
|
if std::io::stdout().is_terminal() {
|
||||||
|
meta_plugin_table.set_format(get_format_box_chars_no_border_line_separator());
|
||||||
|
} else {
|
||||||
|
meta_plugin_table.set_format(*FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_plugin_table.set_titles(row!(
|
||||||
|
b->"Meta Name",
|
||||||
|
b->"Found",
|
||||||
|
b->"Enabled",
|
||||||
|
b->"Binary",
|
||||||
|
b->"Args"));
|
||||||
|
|
||||||
|
for info in meta_plugin_info {
|
||||||
|
meta_plugin_table.add_row(Row::new(vec![
|
||||||
|
Cell::new(&info.meta_name),
|
||||||
|
match info.found {
|
||||||
|
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
||||||
|
false => Cell::new("No").with_style(Attr::ForegroundColor(color::RED)),
|
||||||
|
},
|
||||||
|
match info.enabled {
|
||||||
|
true => Cell::new("Yes").with_style(Attr::ForegroundColor(color::GREEN)),
|
||||||
|
false => Cell::new("No"),
|
||||||
|
},
|
||||||
|
match info.binary.as_str() {
|
||||||
|
"<INTERNAL>" => Cell::new(&info.binary).with_style(Attr::ForegroundColor(color::BRIGHT_BLACK)),
|
||||||
|
"<NOT FOUND>" => Cell::new(&info.binary).with_style(Attr::ForegroundColor(color::RED)),
|
||||||
|
_ => Cell::new(&info.binary),
|
||||||
|
},
|
||||||
|
Cell::new(&info.args),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
meta_plugin_table
|
||||||
|
}
|
||||||
|
|
||||||
pub fn mode_status(
|
pub fn mode_status(
|
||||||
_cmd: &mut Command,
|
_cmd: &mut Command,
|
||||||
@@ -346,18 +271,27 @@ pub fn mode_status(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let output_format = get_output_format(args);
|
let output_format = get_output_format(args);
|
||||||
|
let status_info = generate_status_info(data_path, db_path, &meta_plugin_types);
|
||||||
|
|
||||||
if output_format != OutputFormat::Table {
|
match output_format {
|
||||||
return show_status_structured(data_path, db_path, &meta_plugin_types, output_format);
|
OutputFormat::Table => {
|
||||||
}
|
|
||||||
|
|
||||||
println!("PATHS:");
|
println!("PATHS:");
|
||||||
build_path_table(data_path, db_path).printstd();
|
build_path_table(&status_info.paths).printstd();
|
||||||
println!();
|
println!();
|
||||||
println!("COMPRESSION:");
|
println!("COMPRESSION:");
|
||||||
build_compression_table().printstd();
|
build_compression_table(&status_info.compression).printstd();
|
||||||
println!();
|
println!();
|
||||||
println!("META PLUGINS:");
|
println!("META PLUGINS:");
|
||||||
build_meta_plugin_table(&meta_plugin_types).printstd();
|
build_meta_plugin_table(&status_info.meta_plugins).printstd();
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
OutputFormat::Json => {
|
||||||
|
println!("{}", serde_json::to_string_pretty(&status_info)?);
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
OutputFormat::Yaml => {
|
||||||
|
println!("{}", serde_yaml::to_string(&status_info)?);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user