Skip to main content

cargo_gears_core/
lib.rs

1pub use cargo_gears_macros::HelpSchema;
2
3pub mod app_config;
4pub mod build;
5pub mod common;
6pub mod config;
7pub mod deploy;
8pub mod generate;
9pub mod help;
10pub mod lint;
11pub mod list;
12pub mod manifest;
13pub mod module_parser;
14pub mod run;
15pub mod source;
16pub mod test;
17pub mod tools;
18
19#[derive(Debug, Eq, PartialEq)]
20pub enum GearsCommand {
21    Generate(generate::GenerateParams),
22    Config(config::ConfigParams),
23    Src(source::SourceParams),
24    Help(help::HelpParams),
25    Lint(lint::LintParams),
26    List(list::ListParams),
27    Manifest(manifest::ManifestParams),
28    Test(test::TestParams),
29    Tools(tools::ToolsParams),
30    Run(run::RunParams),
31    Build(build::BuildParams),
32    Deploy(deploy::DeployParams),
33}
34
35impl GearsCommand {
36    pub fn run(&self) -> anyhow::Result<()> {
37        match self {
38            Self::Generate(args) => args.run(),
39            Self::Config(args) => args.run(),
40            Self::Src(args) => args.run(),
41            Self::Help(args) => args.run(),
42            Self::Lint(args) => args.run(),
43            Self::List(args) => args.run(),
44            Self::Manifest(args) => args.run(),
45            Self::Test(args) => args.run(),
46            Self::Tools(args) => args.run(),
47            Self::Run(args) => args.run(),
48            Self::Build(args) => args.run(),
49            Self::Deploy(args) => args.run(),
50        }
51    }
52}