mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
refactor macro variable names (fixes spell-checker/unknown word warnings)
This commit is contained in:
parent
7aa0c92cf8
commit
00779a1fb5
1 changed files with 23 additions and 23 deletions
|
@ -53,37 +53,37 @@ macro_rules! show_usage_error(
|
|||
|
||||
#[macro_export]
|
||||
macro_rules! crash(
|
||||
($exitcode:expr, $($args:tt)+) => ({
|
||||
($exit_code:expr, $($args:tt)+) => ({
|
||||
show_error!($($args)+);
|
||||
::std::process::exit($exitcode)
|
||||
::std::process::exit($exit_code)
|
||||
})
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! exit(
|
||||
($exitcode:expr) => ({
|
||||
::std::process::exit($exitcode)
|
||||
($exit_code:expr) => ({
|
||||
::std::process::exit($exit_code)
|
||||
})
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! crash_if_err(
|
||||
($exitcode:expr, $exp:expr) => (
|
||||
($exit_code:expr, $exp:expr) => (
|
||||
match $exp {
|
||||
Ok(m) => m,
|
||||
Err(f) => crash!($exitcode, "{}", f),
|
||||
Err(f) => crash!($exit_code, "{}", f),
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! return_if_err(
|
||||
($exitcode:expr, $exp:expr) => (
|
||||
($exit_code:expr, $exp:expr) => (
|
||||
match $exp {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
show_error!("{}", f);
|
||||
return $exitcode;
|
||||
return $exit_code;
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -128,8 +128,8 @@ macro_rules! snippet_list_join_oxford {
|
|||
($conjunction:expr, $valOne:expr, $valTwo:expr) => (
|
||||
format!("{}, {} {}", $valOne, $conjunction, $valTwo)
|
||||
);
|
||||
($conjunction:expr, $valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => (
|
||||
format!("{}, {}", $valOne, snippet_list_join_inner!($conjunction, $valTwo $(, $remainingVals)*))
|
||||
($conjunction:expr, $valOne:expr, $valTwo:expr $(, $remaining_values:expr)*) => (
|
||||
format!("{}, {}", $valOne, snippet_list_join_inner!($conjunction, $valTwo $(, $remaining_values)*))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -138,8 +138,8 @@ macro_rules! snippet_list_join_or {
|
|||
($valOne:expr, $valTwo:expr) => (
|
||||
format!("{} or {}", $valOne, $valTwo)
|
||||
);
|
||||
($valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => (
|
||||
format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remainingVals)*))
|
||||
($valOne:expr, $valTwo:expr $(, $remaining_values:expr)*) => (
|
||||
format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remaining_values)*))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -166,10 +166,10 @@ macro_rules! msg_invalid_opt_use {
|
|||
($about:expr, $flag:expr) => {
|
||||
msg_invalid_input!(format!("The '{}' option {}", $flag, $about))
|
||||
};
|
||||
($about:expr, $longflag:expr, $shortflag:expr) => {
|
||||
($about:expr, $long_flag:expr, $short_flag:expr) => {
|
||||
msg_invalid_input!(format!(
|
||||
"The '{}' ('{}') option {}",
|
||||
$longflag, $shortflag, $about
|
||||
$long_flag, $short_flag, $about
|
||||
))
|
||||
};
|
||||
}
|
||||
|
@ -179,8 +179,8 @@ macro_rules! msg_opt_only_usable_if {
|
|||
($clause:expr, $flag:expr) => {
|
||||
msg_invalid_opt_use!(format!("only usable if {}", $clause), $flag)
|
||||
};
|
||||
($clause:expr, $longflag:expr, $shortflag:expr) => {
|
||||
msg_invalid_opt_use!(format!("only usable if {}", $clause), $longflag, $shortflag)
|
||||
($clause:expr, $long_flag:expr, $short_flag:expr) => {
|
||||
msg_invalid_opt_use!(format!("only usable if {}", $clause), $long_flag, $short_flag)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -192,11 +192,11 @@ macro_rules! msg_opt_invalid_should_be {
|
|||
$flag
|
||||
)
|
||||
};
|
||||
($expects:expr, $received:expr, $longflag:expr, $shortflag:expr) => {
|
||||
($expects:expr, $received:expr, $long_flag:expr, $short_flag:expr) => {
|
||||
msg_invalid_opt_use!(
|
||||
format!("expects {}, but was provided {}", $expects, $received),
|
||||
$longflag,
|
||||
$shortflag
|
||||
$long_flag,
|
||||
$short_flag
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -254,14 +254,14 @@ macro_rules! msg_wrong_number_of_arguments {
|
|||
|
||||
#[macro_export]
|
||||
macro_rules! msg_expects_one_of {
|
||||
($valOne:expr $(, $remainingVals:expr)*) => (
|
||||
msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*)))
|
||||
($valOne:expr $(, $remaining_values:expr)*) => (
|
||||
msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remaining_values)*)))
|
||||
);
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! msg_expects_no_more_than_one_of {
|
||||
($valOne:expr $(, $remainingVals:expr)*) => (
|
||||
msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) ;
|
||||
($valOne:expr $(, $remaining_values:expr)*) => (
|
||||
msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remaining_values)*))) ;
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue