[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
4 changed files with 13 additions and 9 deletions

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;