zenyx-engine/xtask/src/main.rs

63 lines
1.4 KiB
Rust
Raw Normal View History

2024-12-01 16:02:06 -05:00
use clap::{CommandFactory, Parser, Subcommand, ValueEnum};
pub mod editor;
pub mod engine;
2024-12-01 16:02:06 -05:00
#[derive(Parser)]
#[command(version, about, long_about = None,disable_version_flag = true,disable_help_flag = true)]
struct Cli {
#[arg(short, long)]
2024-12-01 16:02:06 -05:00
release: bool,
#[command(subcommand)]
command: Option<Commands>,
}
#[derive(Subcommand)]
enum Commands {
Run {
#[arg()]
task: Task,
2024-12-01 16:02:06 -05:00
},
Config,
}
#[derive(Clone, ValueEnum)]
2024-12-01 16:02:06 -05:00
enum Task {
Engine, // Builds both editor and core
Editor, // Builds editor only
Core, // Builds engine core only
Help,
2024-12-01 16:02:06 -05:00
}
fn main() {
let cli = Cli::parse();
if cli.release {
println!("Running in release mode")
}
match &cli.command {
None => {
Cli::command()
.print_help()
.map_err(|e| {
println!("Could not run Xtask: {e}");
})
.unwrap();
2024-12-01 16:02:06 -05:00
}
Some(Commands::Run { task }) => match task {
Task::Engine => engine::build_engine(),
Task::Editor => todo!("Editor is not being actively worked on"),
Task::Core => {
engine::build_core();
2024-12-01 16:02:06 -05:00
}
Task::Help => {
println!("The following options are avalible to run");
todo!()
}
},
2024-12-01 16:02:06 -05:00
Some(Commands::Config) => {
todo!()
}
}
}