diff --git a/crates/nu-command/src/commands/ansi/strip.rs b/crates/nu-command/src/commands/ansi/strip.rs index ab89fcc8c..ede70a2a7 100644 --- a/crates/nu-command/src/commands/ansi/strip.rs +++ b/crates/nu-command/src/commands/ansi/strip.rs @@ -40,7 +40,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let args = args.evaluate_once()?; - let column_paths: Vec<_> = args.rest_args()?; + let column_paths: Vec<_> = args.rest(0)?; let result: Vec = args .input diff --git a/crates/nu-command/src/commands/path/basename.rs b/crates/nu-command/src/commands/path/basename.rs index 5fbbb704a..101259f3b 100644 --- a/crates/nu-command/src/commands/path/basename.rs +++ b/crates/nu-command/src/commands/path/basename.rs @@ -43,7 +43,7 @@ impl WholeStreamCommand for PathBasename { let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathBasenameArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, replace: args.get_flag("replace")?, }); diff --git a/crates/nu-command/src/commands/path/dirname.rs b/crates/nu-command/src/commands/path/dirname.rs index 4b625d6c0..881daf84a 100644 --- a/crates/nu-command/src/commands/path/dirname.rs +++ b/crates/nu-command/src/commands/path/dirname.rs @@ -50,7 +50,7 @@ impl WholeStreamCommand for PathDirname { let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathDirnameArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, replace: args.get_flag("replace")?, num_levels: args.get_flag("num-levels")?, }); diff --git a/crates/nu-command/src/commands/path/exists.rs b/crates/nu-command/src/commands/path/exists.rs index d44198045..12a94e049 100644 --- a/crates/nu-command/src/commands/path/exists.rs +++ b/crates/nu-command/src/commands/path/exists.rs @@ -35,7 +35,7 @@ impl WholeStreamCommand for PathExists { let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathExistsArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, }); Ok(operate(args.input, &action, tag.span, cmd_args)) diff --git a/crates/nu-command/src/commands/path/expand.rs b/crates/nu-command/src/commands/path/expand.rs index 7e9d92f79..b637ae589 100644 --- a/crates/nu-command/src/commands/path/expand.rs +++ b/crates/nu-command/src/commands/path/expand.rs @@ -35,7 +35,7 @@ impl WholeStreamCommand for PathExpand { let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathExpandArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, }); Ok(operate(args.input, &action, tag.span, cmd_args)) diff --git a/crates/nu-command/src/commands/path/join.rs b/crates/nu-command/src/commands/path/join.rs index b115225b1..0d8b50bfa 100644 --- a/crates/nu-command/src/commands/path/join.rs +++ b/crates/nu-command/src/commands/path/join.rs @@ -48,7 +48,7 @@ the output of 'path parse' and 'path split' subcommands."# let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathJoinArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, append: args.get_flag("append")?, }); diff --git a/crates/nu-command/src/commands/path/parse.rs b/crates/nu-command/src/commands/path/parse.rs index 7cf841689..3388148ba 100644 --- a/crates/nu-command/src/commands/path/parse.rs +++ b/crates/nu-command/src/commands/path/parse.rs @@ -50,7 +50,7 @@ On Windows, an extra 'prefix' column is added."# let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathParseArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, extension: args.get_flag("extension")?, }); diff --git a/crates/nu-command/src/commands/path/split.rs b/crates/nu-command/src/commands/path/split.rs index b6e6f42a2..fac4a96f2 100644 --- a/crates/nu-command/src/commands/path/split.rs +++ b/crates/nu-command/src/commands/path/split.rs @@ -35,7 +35,7 @@ impl WholeStreamCommand for PathSplit { let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathSplitArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, }); Ok(operate_split(args.input, &action, tag.span, cmd_args)) diff --git a/crates/nu-command/src/commands/path/type.rs b/crates/nu-command/src/commands/path/type.rs index ed23a8067..58767fb4f 100644 --- a/crates/nu-command/src/commands/path/type.rs +++ b/crates/nu-command/src/commands/path/type.rs @@ -36,7 +36,7 @@ impl WholeStreamCommand for PathType { let tag = args.call_info.name_tag.clone(); let args = args.evaluate_once()?; let cmd_args = Arc::new(PathTypeArguments { - rest: args.rest_args()?, + rest: args.rest(0)?, }); Ok(operate(args.input, &action, tag.span, cmd_args)) diff --git a/crates/nu-command/src/commands/str_/capitalize.rs b/crates/nu-command/src/commands/str_/capitalize.rs index 53ad3469f..77cc453a1 100644 --- a/crates/nu-command/src/commands/str_/capitalize.rs +++ b/crates/nu-command/src/commands/str_/capitalize.rs @@ -46,7 +46,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { Ok(Arguments { - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-command/src/commands/str_/case/mod.rs b/crates/nu-command/src/commands/str_/case/mod.rs index 9c443b21d..775bb0b40 100644 --- a/crates/nu-command/src/commands/str_/case/mod.rs +++ b/crates/nu-command/src/commands/str_/case/mod.rs @@ -26,7 +26,7 @@ where { let (options, input) = args.extract(|params| { Ok(Arguments { - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-command/src/commands/str_/downcase.rs b/crates/nu-command/src/commands/str_/downcase.rs index bc46984eb..9f0d65dac 100644 --- a/crates/nu-command/src/commands/str_/downcase.rs +++ b/crates/nu-command/src/commands/str_/downcase.rs @@ -46,7 +46,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { Ok(Arguments { - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-command/src/commands/str_/from.rs b/crates/nu-command/src/commands/str_/from.rs index e9045e722..b3f3fb612 100644 --- a/crates/nu-command/src/commands/str_/from.rs +++ b/crates/nu-command/src/commands/str_/from.rs @@ -73,7 +73,7 @@ fn operate(args: CommandArgs) -> Result { Ok(Arguments { decimals: params.get_flag("decimals")?, group_digits: false, - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-command/src/commands/str_/length.rs b/crates/nu-command/src/commands/str_/length.rs index 504aae91b..4244255a5 100644 --- a/crates/nu-command/src/commands/str_/length.rs +++ b/crates/nu-command/src/commands/str_/length.rs @@ -54,7 +54,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { Ok(Arguments { - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-command/src/commands/str_/lpad.rs b/crates/nu-command/src/commands/str_/lpad.rs index c79d744ba..1eafe9be9 100644 --- a/crates/nu-command/src/commands/str_/lpad.rs +++ b/crates/nu-command/src/commands/str_/lpad.rs @@ -81,7 +81,7 @@ fn operate(args: CommandArgs) -> Result { Ok(Arc::new(Arguments { length: params.req_named("length")?, character: params.req_named("character")?, - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, })) })?; diff --git a/crates/nu-command/src/commands/str_/reverse.rs b/crates/nu-command/src/commands/str_/reverse.rs index 9fe8a8512..a743409be 100644 --- a/crates/nu-command/src/commands/str_/reverse.rs +++ b/crates/nu-command/src/commands/str_/reverse.rs @@ -44,7 +44,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { Ok(Arguments { - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-command/src/commands/str_/rpad.rs b/crates/nu-command/src/commands/str_/rpad.rs index af0cca9a0..c9d51b06b 100644 --- a/crates/nu-command/src/commands/str_/rpad.rs +++ b/crates/nu-command/src/commands/str_/rpad.rs @@ -81,7 +81,7 @@ fn operate(args: CommandArgs) -> Result { Ok(Arc::new(Arguments { length: params.req_named("length")?, character: params.req_named("character")?, - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, })) })?; diff --git a/crates/nu-command/src/commands/str_/to_datetime.rs b/crates/nu-command/src/commands/str_/to_datetime.rs index 7d31f9406..ffd3bfd93 100644 --- a/crates/nu-command/src/commands/str_/to_datetime.rs +++ b/crates/nu-command/src/commands/str_/to_datetime.rs @@ -128,7 +128,7 @@ struct DatetimeFormat(String); fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { - let (column_paths, _) = arguments(&mut params.rest_args()?)?; + let (column_paths, _) = arguments(&mut params.rest(0)?)?; Ok(Arguments { timezone: params.get_flag("timezone")?, diff --git a/crates/nu-command/src/commands/str_/to_decimal.rs b/crates/nu-command/src/commands/str_/to_decimal.rs index 37a1c398f..e9523fecf 100644 --- a/crates/nu-command/src/commands/str_/to_decimal.rs +++ b/crates/nu-command/src/commands/str_/to_decimal.rs @@ -49,7 +49,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { Ok(Arguments { - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-command/src/commands/str_/to_integer.rs b/crates/nu-command/src/commands/str_/to_integer.rs index d70c86d44..a033eb0dc 100644 --- a/crates/nu-command/src/commands/str_/to_integer.rs +++ b/crates/nu-command/src/commands/str_/to_integer.rs @@ -66,7 +66,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { - let (column_paths, _) = arguments(&mut params.rest_args()?)?; + let (column_paths, _) = arguments(&mut params.rest(0)?)?; Ok(Arguments { radix: params.get_flag("radix")?, diff --git a/crates/nu-command/src/commands/str_/trim/mod.rs b/crates/nu-command/src/commands/str_/trim/mod.rs index c05b3272f..4e7d5d0a1 100644 --- a/crates/nu-command/src/commands/str_/trim/mod.rs +++ b/crates/nu-command/src/commands/str_/trim/mod.rs @@ -26,7 +26,7 @@ where let (options, input) = args.extract(|params| { Ok(Arc::new(Arguments { character: params.get_flag("char")?, - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, })) })?; diff --git a/crates/nu-command/src/commands/str_/upcase.rs b/crates/nu-command/src/commands/str_/upcase.rs index 9d11db427..9f513235a 100644 --- a/crates/nu-command/src/commands/str_/upcase.rs +++ b/crates/nu-command/src/commands/str_/upcase.rs @@ -46,7 +46,7 @@ impl WholeStreamCommand for SubCommand { fn operate(args: CommandArgs) -> Result { let (options, input) = args.extract(|params| { Ok(Arguments { - column_paths: params.rest_args()?, + column_paths: params.rest(0)?, }) })?; diff --git a/crates/nu-engine/src/command_args.rs b/crates/nu-engine/src/command_args.rs index 80af8dcdb..06bc86bcc 100644 --- a/crates/nu-engine/src/command_args.rs +++ b/crates/nu-engine/src/command_args.rs @@ -201,10 +201,6 @@ impl EvaluatedCommandArgsWithoutInput { } } - pub fn rest_args(&self) -> Result, ShellError> { - self.rest(0) - } - pub fn rest(&self, starting_pos: usize) -> Result, ShellError> { let mut output = vec![];