Refactor logging system to switch between stdout and file logging
* Refactor logging to switch between stdout and file logging * Use "clear" instead of "tput reset" for unix * Remove redundant comments
This commit is contained in:
parent
b36fd151b5
commit
cfe961ab71
16 changed files with 252 additions and 148 deletions
|
@ -1 +1,4 @@
|
|||
pub fn build_editor() {}
|
||||
pub fn build_editor() {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
use std::process::Stdio;
|
||||
|
||||
|
||||
pub fn build_engine() {
|
||||
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub fn build_core() {
|
||||
let threads = format!("-j{}",std::thread::available_parallelism().unwrap().get());
|
||||
let threads = format!("-j{}", std::thread::available_parallelism().unwrap().get());
|
||||
|
||||
let mut run = std::process::Command::new("cargo")
|
||||
.arg("run")
|
||||
|
||||
.arg(threads)
|
||||
.arg("--bin")
|
||||
.arg("zenyx")
|
||||
.stdin(Stdio::inherit())
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.stdin(Stdio::inherit())
|
||||
.stdout(Stdio::inherit())
|
||||
.stderr(Stdio::inherit())
|
||||
.spawn()
|
||||
.unwrap();
|
||||
|
||||
run.wait().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
|
||||
use clap::{CommandFactory, Parser, Subcommand, ValueEnum};
|
||||
pub mod engine;
|
||||
pub mod editor;
|
||||
pub mod engine;
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(version, about, long_about = None,disable_version_flag = true,disable_help_flag = true)]
|
||||
struct Cli {
|
||||
#[arg(short,long)]
|
||||
#[arg(short, long)]
|
||||
release: bool,
|
||||
#[command(subcommand)]
|
||||
command: Option<Commands>,
|
||||
|
@ -16,55 +15,48 @@ struct Cli {
|
|||
enum Commands {
|
||||
Run {
|
||||
#[arg()]
|
||||
task: Task
|
||||
task: Task,
|
||||
},
|
||||
Config,
|
||||
|
||||
}
|
||||
#[derive(Clone,ValueEnum)]
|
||||
|
||||
#[derive(Clone, ValueEnum)]
|
||||
enum Task {
|
||||
Engine, // Builds both editor and core
|
||||
Editor, // Builds editor only
|
||||
Core, // Builds engine core only
|
||||
Help,
|
||||
Core, // Builds engine core only
|
||||
Help,
|
||||
}
|
||||
|
||||
|
||||
|
||||
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();
|
||||
Cli::command()
|
||||
.print_help()
|
||||
.map_err(|e| {
|
||||
println!("Could not run Xtask: {e}");
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
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();
|
||||
},
|
||||
Task::Help => {
|
||||
println!("The following options are avalible to run");
|
||||
todo!()
|
||||
},
|
||||
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();
|
||||
}
|
||||
}
|
||||
Task::Help => {
|
||||
println!("The following options are avalible to run");
|
||||
todo!()
|
||||
}
|
||||
},
|
||||
Some(Commands::Config) => {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue