mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 12:35:59 +02:00
Use new functions in which (#3310)
* Use new functions in which * Impl rest_with_minimum and use it * Use has_flag instead of get_switch
This commit is contained in:
@ -281,4 +281,18 @@ impl EvaluatedCommandArgs {
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
pub fn rest_with_minimum<T: FromValue>(
|
||||
&self,
|
||||
pos: usize,
|
||||
count: usize,
|
||||
) -> Result<Vec<T>, ShellError> {
|
||||
let mut output = vec![];
|
||||
for i in pos..pos + count {
|
||||
output.push(self.req(i)?);
|
||||
}
|
||||
output.extend(self.rest(pos + count)?);
|
||||
|
||||
Ok(output)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user