mirror of
https://github.com/nushell/nushell
synced 2024-11-10 23:24:14 +00:00
Add some more cell path support for fun (#316)
This commit is contained in:
parent
6f4993618d
commit
e1468c0440
1 changed files with 17 additions and 0 deletions
|
@ -267,6 +267,23 @@ impl Value {
|
|||
return Err(ShellError::AccessBeyondEnd(val.len(), *origin_span));
|
||||
}
|
||||
}
|
||||
Value::Binary { val, .. } => {
|
||||
if let Some(item) = val.get(*count) {
|
||||
current = Value::Int {
|
||||
val: *item as i64,
|
||||
span: *origin_span,
|
||||
};
|
||||
} else {
|
||||
return Err(ShellError::AccessBeyondEnd(val.len(), *origin_span));
|
||||
}
|
||||
}
|
||||
Value::Range { val, .. } => {
|
||||
if let Some(item) = val.clone().into_range_iter()?.nth(*count) {
|
||||
current = item.clone();
|
||||
} else {
|
||||
return Err(ShellError::AccessBeyondEndOfStream(*origin_span));
|
||||
}
|
||||
}
|
||||
x => {
|
||||
return Err(ShellError::IncompatiblePathAccess(
|
||||
format!("{}", x.get_type()),
|
||||
|
|
Loading…
Reference in a new issue