From d9bedaae2f7e2c2d5d9949138b56e2b7628c4c56 Mon Sep 17 00:00:00 2001 From: JT <547158+jntrnr@users.noreply.github.com> Date: Fri, 3 Dec 2021 10:36:54 +1300 Subject: [PATCH] Fix plurals in abbrevations (#409) --- crates/nu-protocol/src/value/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/nu-protocol/src/value/mod.rs b/crates/nu-protocol/src/value/mod.rs index 1dacf68799..37af20e67c 100644 --- a/crates/nu-protocol/src/value/mod.rs +++ b/crates/nu-protocol/src/value/mod.rs @@ -345,8 +345,16 @@ impl Value { ) } Value::String { val, .. } => val, - Value::List { vals: val, .. } => format!("[list {} items]", val.len()), - Value::Record { cols, .. } => format!("{{record {} fields}}", cols.len()), + Value::List { vals: val, .. } => format!( + "[list {} item{}]", + val.len(), + if val.len() == 1 { "" } else { "s" } + ), + Value::Record { cols, .. } => format!( + "{{record {} field{}}}", + cols.len(), + if cols.len() == 1 { "" } else { "s" } + ), Value::Block { val, .. } => format!("", val), Value::Nothing { .. } => String::new(), Value::Error { error } => format!("{:?}", error),