mirror of
https://github.com/nushell/nushell.git
synced 2025-07-01 07:00:37 +02:00
feat(random): add random-integer and random-uuid (#440)
* feat(randome): add random-integer * feat(random): add random-uuid
This commit is contained in:
@ -214,6 +214,17 @@ impl Value {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn as_integer(&self) -> Result<i64, ShellError> {
|
||||
match self {
|
||||
Value::Int { val, .. } => Ok(*val),
|
||||
x => Err(ShellError::CantConvert(
|
||||
"float".into(),
|
||||
x.get_type().to_string(),
|
||||
self.span()?,
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the span for the current value
|
||||
pub fn span(&self) -> Result<Span, ShellError> {
|
||||
match self {
|
||||
|
Reference in New Issue
Block a user