aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart/src/commands/fund.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-22 23:40:16 +0900
committernsfisis <nsfisis@gmail.com>2026-02-22 23:40:16 +0900
commitd0866c96a250078c23d2916598da2411993a8892 (patch)
tree1783f46f6442277fa11812c6a89801bac8dd7096 /crates/mozart/src/commands/fund.rs
parent8d4f6a4222b9228b97b965034feba78c4c4d6bcd (diff)
downloadphp-mozart-d0866c96a250078c23d2916598da2411993a8892.tar.gz
php-mozart-d0866c96a250078c23d2916598da2411993a8892.tar.zst
php-mozart-d0866c96a250078c23d2916598da2411993a8892.zip
fix(fund): use 4-space JSON indentation to match Composer
Composer's JsonFile::encode uses JSON_PRETTY_PRINT with 4-space indent. Mozart was using serde_json::to_string_pretty which defaults to 2-space. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/fund.rs')
-rw-r--r--crates/mozart/src/commands/fund.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/mozart/src/commands/fund.rs b/crates/mozart/src/commands/fund.rs
index 181e6e0..36c9325 100644
--- a/crates/mozart/src/commands/fund.rs
+++ b/crates/mozart/src/commands/fund.rs
@@ -1,4 +1,5 @@
use clap::Args;
+use serde::Serialize;
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
@@ -217,7 +218,11 @@ fn render_text(grouped: &BTreeMap<String, BTreeMap<String, Vec<String>>>) {
}
fn render_json(grouped: &BTreeMap<String, BTreeMap<String, Vec<String>>>) -> anyhow::Result<()> {
- println!("{}", serde_json::to_string_pretty(grouped)?);
+ let buf = Vec::new();
+ let formatter = serde_json::ser::PrettyFormatter::with_indent(b" ");
+ let mut ser = serde_json::Serializer::with_formatter(buf, formatter);
+ grouped.serialize(&mut ser)?;
+ println!("{}", String::from_utf8(ser.into_inner())?);
Ok(())
}