diff --git a/src/commands/from_ssv.rs b/src/commands/from_ssv.rs index 0d56c20e0a..4cbb3c78f6 100644 --- a/src/commands/from_ssv.rs +++ b/src/commands/from_ssv.rs @@ -7,7 +7,8 @@ pub struct FromSSV; #[derive(Deserialize)] pub struct FromSSVArgs { headerless: bool, - n: Option>, + #[serde(rename(deserialize = "minimum-spaces"))] + minimum_spaces: Option>, } const STRING_REPRESENTATION: &str = "from-ssv"; @@ -21,7 +22,7 @@ impl WholeStreamCommand for FromSSV { fn signature(&self) -> Signature { Signature::build(STRING_REPRESENTATION) .switch("headerless") - .named("n", SyntaxShape::Int) + .named("minimum-spaces", SyntaxShape::Int) } fn usage(&self) -> &str { @@ -103,14 +104,17 @@ fn from_ssv_string_to_value( } fn from_ssv( - FromSSVArgs { headerless, n }: FromSSVArgs, + FromSSVArgs { + headerless, + minimum_spaces, + }: FromSSVArgs, RunnableContext { input, name, .. }: RunnableContext, ) -> Result { let stream = async_stream! { let values: Vec> = input.values.collect().await; let mut concat_string = String::new(); let mut latest_tag: Option = None; - let split_at = match n { + let split_at = match minimum_spaces { Some(number) => number.item, None => DEFAULT_ALLOWED_SPACES }; diff --git a/tests/filters_test.rs b/tests/filters_test.rs index a84622c37f..f0d5dead61 100644 --- a/tests/filters_test.rs +++ b/tests/filters_test.rs @@ -400,7 +400,7 @@ fn converts_from_ssv_text_to_structured_table_with_separator_specified() { cwd: dirs.test(), h::pipeline( r#" open oc_get_svc.txt - | from-ssv -n 3 + | from-ssv --minimum-spaces 3 | nth 0 | get IP | echo $it