mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-02 12:11:40 +00:00
router: make format&print generic
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
46e803256e
commit
2cf54dcf2e
@ -2,6 +2,7 @@
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use serde::Serialize;
|
||||
use serde_json::Value;
|
||||
|
||||
use proxmox_schema::format::{
|
||||
@ -17,7 +18,7 @@ use super::{CliCommand, CliCommandMap, CommandLineInterface};
|
||||
/// This is implemented for machine generatable formats 'json' and
|
||||
/// 'json-pretty'. The 'text' format needs to be handled somewhere
|
||||
/// else.
|
||||
pub fn format_and_print_result(result: &Value, output_format: &str) {
|
||||
pub fn format_and_print_result<T: Serialize>(result: &T, output_format: &str) {
|
||||
if output_format == "json-pretty" {
|
||||
println!("{}", serde_json::to_string_pretty(&result).unwrap());
|
||||
} else if output_format == "json" {
|
||||
|
Loading…
Reference in New Issue
Block a user