diff --git a/src/commands/get.rs b/src/commands/get.rs index cda637495e..08474ac2c1 100644 --- a/src/commands/get.rs +++ b/src/commands/get.rs @@ -10,7 +10,6 @@ pub struct Get; #[derive(Deserialize)] pub struct GetArgs { member: ColumnPath, - rest: Vec, } impl WholeStreamCommand for Get { @@ -118,13 +117,10 @@ pub fn get_column_path( } pub fn get( - GetArgs { - member, - rest: fields, - }: GetArgs, + GetArgs { member }: GetArgs, RunnableContext { input, .. }: RunnableContext, ) -> Result { - trace!("get {:?} {:?}", member, fields); + trace!("get {:?}", member); let stream = input .values @@ -133,12 +129,7 @@ pub fn get( let member = vec![member.clone()]; - let column_paths = vec![&member, &fields] - .into_iter() - .flatten() - .collect::>(); - - for path in column_paths { + for path in member { let res = get_column_path(&path, &item); match res { diff --git a/src/plugins/str.rs b/src/plugins/str.rs index cab9c6a96a..7fb694d3a5 100644 --- a/src/plugins/str.rs +++ b/src/plugins/str.rs @@ -41,9 +41,13 @@ impl Str { if start > input.len() - 1 { Value::string("") } else { - // Index operator isn't perfect: - // https://users.rust-lang.org/t/how-to-get-a-substring-of-a-string/1351 - Value::string(&input[start..end]) + Value::string( + &input + .chars() + .skip(start) + .take(end - start) + .collect::(), + ) } } Some(Action::ToInteger) => match input.trim() {