Merge branch 'nushell:main' into main

This commit is contained in:
Justin 2021-10-12 14:56:45 -07:00 committed by GitHub
commit f5ce63ad55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

7
Cargo.lock generated
View file

@ -113,6 +113,12 @@ dependencies = [
"utf8-width",
]
[[package]]
name = "bytesize"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70"
[[package]]
name = "cc"
version = "1.0.71"
@ -533,6 +539,7 @@ dependencies = [
name = "nu-command"
version = "0.1.0"
dependencies = [
"bytesize",
"chrono",
"glob",
"lscolors",

View file

@ -24,6 +24,7 @@ sysinfo = "0.20.4"
chrono = { version = "0.4.19", features = ["serde"] }
terminal_size = "0.1.17"
lscolors = { version = "0.8.0", features = ["crossterm"] }
bytesize = "1.1.0"
[features]
trash-support = ["trash"]

View file

@ -160,8 +160,8 @@ pub fn action(input: Value, span: Span) -> Value {
}
}
fn int_from_string(a_string: &str, span: Span) -> Result<i64, ShellError> {
match a_string.parse::<i64>() {
Ok(n) => Ok(n),
match a_string.parse::<bytesize::ByteSize>() {
Ok(n) => Ok(n.0 as i64),
Err(_) => Err(ShellError::CantConvert("int".into(), span)),
}
}