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:
Jason Spalti 2024-12-02 11:51:39 -06:00 committed by BitSyndicate
parent d449c61643
commit a4a8c59bb8
Signed by untrusted user: bitsyndicate
GPG key ID: 443E4198D6BBA6DE
16 changed files with 252 additions and 148 deletions

View file

@ -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!()
}
}
}
}