nibi/
cmd.rs

1use combu::{
2	Command, Context, Flag, action_result, checks,
3	command::presets::func::help_tablize_with_alias_dedup, copyright, crate_authors, crate_license,
4	crate_version, done, flags, license, vector,
5};
6use common::sub_help;
7
8use crate::nibi_copyright;
9
10pub mod build;
11mod common;
12pub mod init;
13pub mod new;
14
15pub fn treed_cmd() -> Command {
16	Command::with_all_field(
17		"nibi".to_owned(),
18		Some(root_action),
19		crate_authors!().to_owned(),
20		nibi_copyright!(),
21		license!(crate_license!().to_owned(),file_path=>"../LICENSE"),
22		Some(crate_authors!().to_owned()),
23		"nibi [subcommand] [options]".to_owned(),
24		flags!(),
25		flags!(help, version, license, authors, copyright),
26		vector![],
27		crate_version!().to_owned(),
28		vector![sub_help(), init::cmd(), build::cmd(), new::threed_cmd()],
29	)
30}
31
32fn root_action(cmd: Command, ctx: Context) -> action_result!() {
33	checks!(cmd, ctx, [error, help, version, license]);
34	println!("サブコマンドの指定がないため、ヘルプを表示します");
35	let help = help_tablize_with_alias_dedup(&cmd, &ctx);
36	println!("{help}");
37	done!()
38}