mirror of
https://github.com/nushell/nushell.git
synced 2025-01-27 00:28:41 +01:00
Remove raw data debugging.
This commit is contained in:
parent
1a0b339897
commit
bc2d65cd2e
@ -4,9 +4,7 @@ use crate::prelude::*;
|
|||||||
pub struct Debug;
|
pub struct Debug;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct DebugArgs {
|
pub struct DebugArgs {}
|
||||||
raw: Tagged<bool>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl WholeStreamCommand for Debug {
|
impl WholeStreamCommand for Debug {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
@ -14,7 +12,7 @@ impl WholeStreamCommand for Debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("debug").switch("raw", "print raw data")
|
Signature::build("debug")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn usage(&self) -> &str {
|
fn usage(&self) -> &str {
|
||||||
@ -31,19 +29,14 @@ impl WholeStreamCommand for Debug {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn debug_value(
|
fn debug_value(
|
||||||
DebugArgs { raw }: DebugArgs,
|
_args: DebugArgs,
|
||||||
RunnableContext { mut input, .. }: RunnableContext,
|
RunnableContext { mut input, .. }: RunnableContext,
|
||||||
) -> Result<OutputStream, ShellError> {
|
) -> Result<impl ToOutputStream, ShellError> {
|
||||||
let stream = async_stream! {
|
let stream = async_stream! {
|
||||||
while let Some(row) = input.values.next().await {
|
while let Some(row) = input.values.next().await {
|
||||||
if let Tagged { item: true, .. } = raw {
|
|
||||||
println!("{:?}", row);
|
|
||||||
yield ReturnSuccess::value(row)
|
|
||||||
} else {
|
|
||||||
yield ReturnSuccess::debug_value(row.clone())
|
yield ReturnSuccess::debug_value(row.clone())
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(stream.to_output_stream())
|
Ok(stream)
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ fn compact_rows_where_given_column_is_empty() {
|
|||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn compact_empty_rows_by_default() {
|
fn compact_empty_rows_by_default() {
|
||||||
Playground::setup("compact_test_2", |dirs, sandbox| {
|
Playground::setup("compact_test_2", |dirs, _| {
|
||||||
let actual = nu!(
|
let actual = nu!(
|
||||||
cwd: dirs.test(), h::pipeline(
|
cwd: dirs.test(), h::pipeline(
|
||||||
r#"
|
r#"
|
||||||
|
Loading…
Reference in New Issue
Block a user