From 659b104ba84bd45251662d0921fe007228624534 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 3 May 2021 14:20:12 +0100 Subject: [PATCH] bundles: Better output from list-bundles Signed-off-by: Ian Jackson --- src/bin/otter.rs | 2 +- src/bundles.rs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/bin/otter.rs b/src/bin/otter.rs index 1c663db7..13f708a1 100644 --- a/src/bin/otter.rs +++ b/src/bin/otter.rs @@ -1391,7 +1391,7 @@ mod list_bundles { if_let!{ MR::Bundles { bundles } = resp; else throw!(anyhow!("unexpected {:?}", &resp)) }; for (id, state) in bundles { - println!("{} {:?}", id, &state); + println!("{} {}", id, &state); } } diff --git a/src/bundles.rs b/src/bundles.rs index 66e80c0b..0d003595 100644 --- a/src/bundles.rs +++ b/src/bundles.rs @@ -75,6 +75,19 @@ pub struct Loaded { meta: BundleMeta, } +impl Display for State { + #[throws(fmt::Error)] + fn fmt(&self, f: &mut Formatter) { + match self { + State::Loaded(Loaded{ meta }) => { + let BundleMeta { title } = meta; + write!(f, "Loaded {:?}", title)?; + } + other => write!(f, "{:?}", other)?, + } + } +} + pub fn b_dir(instance: &InstanceName) -> String { savefilename(instance, "b-", "") } -- 2.30.2