From ff236da72cec48aa31af4a75dcaacff1612d2c28 Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Wed, 7 Oct 2020 03:26:16 +0100 Subject: [PATCH] [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). --- Cargo.lock | 14 ++++++++++---- crates/nu-cli/Cargo.toml | 1 - crates/nu-cli/src/env/host.rs | 5 ++--- crates/nu_plugin_textview/src/textview.rs | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 97d2cb0da..a32ab7bc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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" diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index 893056911..9b55e51cf 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -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" diff --git a/crates/nu-cli/src/env/host.rs b/crates/nu-cli/src/env/host.rs index 90327ead1..a361ea203 100644 --- a/crates/nu-cli/src/env/host.rs +++ b/crates/nu-cli/src/env/host.rs @@ -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 } } diff --git a/crates/nu_plugin_textview/src/textview.rs b/crates/nu_plugin_textview/src/textview.rs index e99adf146..e5a527e79 100644 --- a/crates/nu_plugin_textview/src/textview.rs +++ b/crates/nu_plugin_textview/src/textview.rs @@ -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;