From db252d043e9994bf55ab06d0e7968d9fadeea73e Mon Sep 17 00:00:00 2001 From: Turiiya <34311583+ttytm@users.noreply.github.com> Date: Fri, 8 Mar 2024 01:57:58 +0700 Subject: [PATCH] cli: add pluralization to err msg, if required number of args is not met (#20971) --- vlib/cli/command.v | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vlib/cli/command.v b/vlib/cli/command.v index 93f90a4cb4..64c57289b2 100644 --- a/vlib/cli/command.v +++ b/vlib/cli/command.v @@ -230,7 +230,8 @@ fn (mut cmd Command) parse_commands() { // if no further command was found, execute current command if cmd.required_args > 0 { if cmd.required_args > cmd.args.len { - eprintln_exit('Command `${cmd.name}` needs at least ${cmd.required_args} arguments') + descriptor := if cmd.required_args == 1 { 'argument' } else { 'arguments' } + eprintln_exit('Command `${cmd.name}` needs at least ${cmd.required_args} ${descriptor}') } } cmd.check_required_flags()