mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
uucore: allow 'wrong number of arguments' macro to be more precise
This commit is contained in:
parent
268b691881
commit
ee3aaa017f
1 changed files with 15 additions and 2 deletions
|
@ -327,8 +327,21 @@ macro_rules! msg_args_nonexistent_file { ($received:expr) => (
|
|||
msg_args_invalid_value!("paths to files", snippet_no_file_at_path!($received)));}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! msg_wrong_number_of_arguments { () => (
|
||||
msg_args_invalid_value!("wrong number of arguments") ); }
|
||||
macro_rules! msg_wrong_number_of_arguments {
|
||||
() => (
|
||||
msg_args_invalid_value!("wrong number of arguments")
|
||||
);
|
||||
($min:expr, $max:expr) => (
|
||||
msg_args_invalid_value!(format!("expects {}-{} arguments", $min, $max))
|
||||
);
|
||||
($exact:expr) => (
|
||||
if $exact == 1 {
|
||||
msg_args_invalid_value!("expects 1 argument")
|
||||
} else {
|
||||
msg_args_invalid_value!(format!("expects {} arguments", $exact))
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// -- message templates : invalid input : input combinations
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue