[wasi] Update time & instant crates (#2645)

* [wasi] Update time & instant crates

In https://github.com/nushell/nushell/pull/2643 instant was updated by adding it as a hard dependency in Cargo.toml, but it's better to avoid it and only update in Cargo.lock via `cargo update -p ...`.

Additionally, updated `time` crate so that now some basic commands like `ls` work too, although formatting is pretty bad.

* Update default terminal width to 80

If termsize can't return anything, use 80 chars (e.g. on WASI).
This commit is contained in:
Ingvar Stepanyan 2020-10-07 03:26:16 +01:00 committed by GitHub
parent 54326869e4
commit ff236da72c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 9 deletions

14
Cargo.lock generated
View file

@ -1747,7 +1747,7 @@ checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
dependencies = [
"cfg-if",
"libc",
"wasi",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
@ -2934,7 +2934,6 @@ dependencies = [
"ical",
"ichwh",
"indexmap",
"instant",
"itertools",
"log 0.4.11",
"meval",
@ -5212,11 +5211,12 @@ dependencies = [
[[package]]
name = "time"
version = "0.1.43"
version = "0.1.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
dependencies = [
"libc",
"wasi 0.10.0+wasi-snapshot-preview1",
"winapi 0.3.9",
]
@ -5805,6 +5805,12 @@ version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.10.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
[[package]]
name = "wasm-bindgen"
version = "0.2.67"

View file

@ -52,7 +52,6 @@ htmlescape = "0.3.1"
ical = "0.6.0"
ichwh = {version = "0.3.4", optional = true}
indexmap = {version = "1.6.0", features = ["serde-1"]}
instant = "0.1.7"
itertools = "0.9.0"
log = "0.4.11"
meval = "0.2.0"

View file

@ -126,9 +126,8 @@ impl Host for BasicHost {
}
fn width(&self) -> usize {
let (mut term_width, _) = term_size::dimensions().unwrap_or_else(|| (20, 20));
term_width -= 1;
std::cmp::max(term_width, 20)
let (term_width, _) = term_size::dimensions().unwrap_or_else(|| (80, 20));
term_width
}
}

View file

@ -13,7 +13,7 @@ impl TextView {
#[allow(clippy::cognitive_complexity)]
pub fn view_text_value(value: &Value) {
let (mut term_width, _) = term_size::dimensions().unwrap_or_else(|| (20, 20));
let (mut term_width, _) = term_size::dimensions().unwrap_or_else(|| (80, 20));
let mut tab_width: u64 = 4;
let mut colored_output = true;
let mut true_color = true;