mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
change/uucore ~ add execution_phrase!()
macro for use with usage messages
This commit is contained in:
parent
f56fc5bf44
commit
318f366ace
1 changed files with 17 additions and 0 deletions
|
@ -58,6 +58,23 @@ macro_rules! util_name(
|
||||||
|
|
||||||
//====
|
//====
|
||||||
|
|
||||||
|
/// Derive the complete execution phrase for "usage".
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! execution_phrase(
|
||||||
|
() => ({
|
||||||
|
let exe = if (executable_name!() == util_name!()) {
|
||||||
|
executable!().to_string()
|
||||||
|
} else {
|
||||||
|
format!("{} {}", executable!(), util_name!())
|
||||||
|
.as_str()
|
||||||
|
.to_owned()
|
||||||
|
};
|
||||||
|
&exe.to_owned()
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
//====
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! show(
|
macro_rules! show(
|
||||||
($err:expr) => ({
|
($err:expr) => ({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue