From 8d3a937413abbee6470d9d3f47a2b7d4f6ffa539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20N=2E=20Robalino?= Date: Sat, 23 Nov 2019 18:53:50 -0500 Subject: [PATCH] Display raw debugging data (rust represetantion). --- src/commands/debug.rs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/commands/debug.rs b/src/commands/debug.rs index f9639b7263..b31f65ca2e 100644 --- a/src/commands/debug.rs +++ b/src/commands/debug.rs @@ -4,7 +4,9 @@ use crate::prelude::*; pub struct Debug; #[derive(Deserialize)] -pub struct DebugArgs {} +pub struct DebugArgs { + raw: Tagged, +} impl WholeStreamCommand for Debug { fn name(&self) -> &str { @@ -12,7 +14,7 @@ impl WholeStreamCommand for Debug { } fn signature(&self) -> Signature { - Signature::build("debug") + Signature::build("debug").switch("raw", "print raw data") } fn usage(&self) -> &str { @@ -29,14 +31,19 @@ impl WholeStreamCommand for Debug { } fn debug_value( - _args: DebugArgs, + DebugArgs { raw }: DebugArgs, RunnableContext { mut input, .. }: RunnableContext, -) -> Result { +) -> Result { let stream = async_stream! { while let Some(row) = input.values.next().await { - yield ReturnSuccess::debug_value(row.clone()) + if let Tagged { item: true, .. } = raw { + println!("{:?}", row); + yield ReturnSuccess::value(row) + } else { + yield ReturnSuccess::debug_value(row.clone()) + } } }; - Ok(stream) + Ok(stream.to_output_stream()) }