1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#[macro_export]
macro_rules! subcmd {
($name:ident, [$($variant:ident=$comment:expr),*]) => {
$crate::paste! {
#[derive(clap::Subcommand, Debug, Clone)]
#[enum_dispatch]
#[non_exhaustive]
pub enum $name {
$(
#[doc=$comment]
$variant([<$name $variant Command>]),
)*
}
}
};
}
#[macro_export]
macro_rules! mod_pub_use {
($($name:ident),*) => {
$(
mod $name;
pub use $name::*;
)*
};
}
#[macro_export]
macro_rules! error_report {
($s:literal) => {
Err($crate::anyhow::anyhow!($s)).report()
};
($fmt:expr, $($arg:tt)*) => {
Err($crate::anyhow::anyhow!($fmt, $($arg)*)).report()
};
}