use clap::ValueEnum;
use serde::Serialize;
#[derive(Clone, Copy, Debug, ValueEnum)]
pub enum Format {
Json,
Text,
}
/// Print a serializable value to stdout in the requested format.
pub fn print_json<T: Serialize + ?Sized>(value: &T) -> anyhow::Result<()> {
println!("{}", serde_json::to_string_pretty(value)?);
Ok(())
}
/// Print a JSON payload to stdout as compact text.
pub fn print_text(value: &serde_json::Value) -> anyhow::Result<()> {
println!("{}", serde_json::to_string(value)?);
Ok(())
}