mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 14:07:46 +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_export]
|
||||||
macro_rules! crash(
|
macro_rules! crash(
|
||||||
($exitcode:expr, $($args:tt)+) => ({
|
($exit_code:expr, $($args:tt)+) => ({
|
||||||
show_error!($($args)+);
|
show_error!($($args)+);
|
||||||
::std::process::exit($exitcode)
|
::std::process::exit($exit_code)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! exit(
|
macro_rules! exit(
|
||||||
($exitcode:expr) => ({
|
($exit_code:expr) => ({
|
||||||
::std::process::exit($exitcode)
|
::std::process::exit($exit_code)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! crash_if_err(
|
macro_rules! crash_if_err(
|
||||||
($exitcode:expr, $exp:expr) => (
|
($exit_code:expr, $exp:expr) => (
|
||||||
match $exp {
|
match $exp {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => crash!($exitcode, "{}", f),
|
Err(f) => crash!($exit_code, "{}", f),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! return_if_err(
|
macro_rules! return_if_err(
|
||||||
($exitcode:expr, $exp:expr) => (
|
($exit_code:expr, $exp:expr) => (
|
||||||
match $exp {
|
match $exp {
|
||||||
Ok(m) => m,
|
Ok(m) => m,
|
||||||
Err(f) => {
|
Err(f) => {
|
||||||
show_error!("{}", 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) => (
|
($conjunction:expr, $valOne:expr, $valTwo:expr) => (
|
||||||
format!("{}, {} {}", $valOne, $conjunction, $valTwo)
|
format!("{}, {} {}", $valOne, $conjunction, $valTwo)
|
||||||
);
|
);
|
||||||
($conjunction:expr, $valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => (
|
($conjunction:expr, $valOne:expr, $valTwo:expr $(, $remaining_values:expr)*) => (
|
||||||
format!("{}, {}", $valOne, snippet_list_join_inner!($conjunction, $valTwo $(, $remainingVals)*))
|
format!("{}, {}", $valOne, snippet_list_join_inner!($conjunction, $valTwo $(, $remaining_values)*))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +138,8 @@ macro_rules! snippet_list_join_or {
|
||||||
($valOne:expr, $valTwo:expr) => (
|
($valOne:expr, $valTwo:expr) => (
|
||||||
format!("{} or {}", $valOne, $valTwo)
|
format!("{} or {}", $valOne, $valTwo)
|
||||||
);
|
);
|
||||||
($valOne:expr, $valTwo:expr $(, $remainingVals:expr)*) => (
|
($valOne:expr, $valTwo:expr $(, $remaining_values:expr)*) => (
|
||||||
format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remainingVals)*))
|
format!("{}, {}", $valOne, snippet_list_join_oxford!("or", $valTwo $(, $remaining_values)*))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,10 +166,10 @@ macro_rules! msg_invalid_opt_use {
|
||||||
($about:expr, $flag:expr) => {
|
($about:expr, $flag:expr) => {
|
||||||
msg_invalid_input!(format!("The '{}' option {}", $flag, $about))
|
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!(
|
msg_invalid_input!(format!(
|
||||||
"The '{}' ('{}') option {}",
|
"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) => {
|
($clause:expr, $flag:expr) => {
|
||||||
msg_invalid_opt_use!(format!("only usable if {}", $clause), $flag)
|
msg_invalid_opt_use!(format!("only usable if {}", $clause), $flag)
|
||||||
};
|
};
|
||||||
($clause:expr, $longflag:expr, $shortflag:expr) => {
|
($clause:expr, $long_flag:expr, $short_flag:expr) => {
|
||||||
msg_invalid_opt_use!(format!("only usable if {}", $clause), $longflag, $shortflag)
|
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
|
$flag
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
($expects:expr, $received:expr, $longflag:expr, $shortflag:expr) => {
|
($expects:expr, $received:expr, $long_flag:expr, $short_flag:expr) => {
|
||||||
msg_invalid_opt_use!(
|
msg_invalid_opt_use!(
|
||||||
format!("expects {}, but was provided {}", $expects, $received),
|
format!("expects {}, but was provided {}", $expects, $received),
|
||||||
$longflag,
|
$long_flag,
|
||||||
$shortflag
|
$short_flag
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -254,14 +254,14 @@ macro_rules! msg_wrong_number_of_arguments {
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! msg_expects_one_of {
|
macro_rules! msg_expects_one_of {
|
||||||
($valOne:expr $(, $remainingVals:expr)*) => (
|
($valOne:expr $(, $remaining_values:expr)*) => (
|
||||||
msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*)))
|
msg_invalid_input!(format!("expects one of {}", snippet_list_join_or!($valOne $(, $remaining_values)*)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! msg_expects_no_more_than_one_of {
|
macro_rules! msg_expects_no_more_than_one_of {
|
||||||
($valOne:expr $(, $remainingVals:expr)*) => (
|
($valOne:expr $(, $remaining_values:expr)*) => (
|
||||||
msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remainingVals)*))) ;
|
msg_invalid_input!(format!("expects no more than one of {}", snippet_list_join_or!($valOne $(, $remaining_values)*))) ;
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue