Add build_subcommand! macro
This commit is contained in:
parent
a825f4aba6
commit
85cd326818
1 changed files with 22 additions and 52 deletions
72
bin/build.rs
72
bin/build.rs
|
@ -17,6 +17,15 @@ macro_rules! gen_types_buildui {
|
|||
)
|
||||
}
|
||||
|
||||
macro_rules! build_subcommand {
|
||||
($name:expr, $module:ident) => (
|
||||
$module::build_ui(Runtime::get_default_cli_builder(
|
||||
$name,
|
||||
&version!()[..],
|
||||
$name))
|
||||
)
|
||||
}
|
||||
|
||||
gen_types_buildui!(
|
||||
("../imag-bookmark/src/ui.rs", imagbookmark),
|
||||
("../imag-counter/src/ui.rs", imagcounter),
|
||||
|
@ -35,59 +44,20 @@ fn main() {
|
|||
"imag",
|
||||
&version!()[..],
|
||||
"imag")
|
||||
.subcommand(
|
||||
imagbookmark::build_ui(Runtime::get_default_cli_builder(
|
||||
"bookmark",
|
||||
&version!()[..],
|
||||
"bookmark")))
|
||||
.subcommand(
|
||||
imagcounter::build_ui(Runtime::get_default_cli_builder(
|
||||
"counter",
|
||||
&version!()[..],
|
||||
"counter")))
|
||||
.subcommand(
|
||||
imagdiary::build_ui(Runtime::get_default_cli_builder(
|
||||
"diary",
|
||||
&version!()[..],
|
||||
"diary")))
|
||||
.subcommand(
|
||||
imaglink::build_ui(Runtime::get_default_cli_builder(
|
||||
"link",
|
||||
&version!()[..],
|
||||
"link")))
|
||||
.subcommand(
|
||||
imagnotes::build_ui(Runtime::get_default_cli_builder(
|
||||
"notes",
|
||||
&version!()[..],
|
||||
"notes")))
|
||||
.subcommand(
|
||||
imagref::build_ui(Runtime::get_default_cli_builder(
|
||||
"ref",
|
||||
&version!()[..],
|
||||
"ref")))
|
||||
.subcommand(
|
||||
imagstore::build_ui(Runtime::get_default_cli_builder(
|
||||
"store",
|
||||
&version!()[..],
|
||||
"store")))
|
||||
.subcommand(
|
||||
imagtag::build_ui(Runtime::get_default_cli_builder(
|
||||
"tag",
|
||||
&version!()[..],
|
||||
"tag")))
|
||||
.subcommand(
|
||||
imagtodo::build_ui(Runtime::get_default_cli_builder(
|
||||
"todo",
|
||||
&version!()[..],
|
||||
"todo")))
|
||||
.subcommand(
|
||||
imagview::build_ui(Runtime::get_default_cli_builder(
|
||||
"view",
|
||||
&version!()[..],
|
||||
"view")))
|
||||
;
|
||||
.subcommand(build_subcommand!("bookmark", imagbookmark))
|
||||
.subcommand(build_subcommand!("counter", imagcounter))
|
||||
.subcommand(build_subcommand!("diary", imagdiary))
|
||||
.subcommand(build_subcommand!("link", imaglink))
|
||||
.subcommand(build_subcommand!("notes", imagnotes))
|
||||
.subcommand(build_subcommand!("ref", imagref))
|
||||
.subcommand(build_subcommand!("store", imagstore))
|
||||
.subcommand(build_subcommand!("tag", imagtag))
|
||||
.subcommand(build_subcommand!("todo", imagtodo))
|
||||
.subcommand(build_subcommand!("view", imagview));
|
||||
|
||||
app.gen_completions("imag", Shell::Bash, env!("OUT_DIR"));
|
||||
app.gen_completions("imag", Shell::Fish, env!("OUT_DIR"));
|
||||
app.gen_completions("imag", Shell::Zsh, env!("OUT_DIR"));
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue