From af1b4fec40e72da6dab29c8af90f780d5891c3cc Mon Sep 17 00:00:00 2001 From: tangowithfoxtrot <5676771+tangowithfoxtrot@users.noreply.github.com> Date: Fri, 3 Nov 2023 04:29:15 -0700 Subject: [PATCH] add `-o env` output --- crates/bws/src/render.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/bws/src/render.rs b/crates/bws/src/render.rs index 4f2a32e9a..77f41f4bf 100644 --- a/crates/bws/src/render.rs +++ b/crates/bws/src/render.rs @@ -9,6 +9,7 @@ use serde::Serialize; pub(crate) enum Output { JSON, YAML, + Env, Table, TSV, None, @@ -49,6 +50,14 @@ pub(crate) fn serialize_response, const N: usiz let text = serde_yaml::to_string(&data).unwrap(); pretty_print("yaml", &text, color); } + Output::Env => { + let text: Vec = data + .get_values() + .into_iter() + .map(|row| format!("{}=\"{}\"", row[1], row[2])) + .collect(); + println!("{}", text.join("\n")); + } Output::Table => { let mut table = Table::new(); table