From ad758d5f996aed9284722f58c1b0b486cb39f060 Mon Sep 17 00:00:00 2001 From: oneofthezombies Date: Tue, 6 Feb 2024 20:07:47 +0900 Subject: [PATCH] build: update build --- .cargo-husky/hooks/pre-push | 13 ++----------- crates/tools/dev/src/main.rs | 11 ++++++++++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.cargo-husky/hooks/pre-push b/.cargo-husky/hooks/pre-push index f1587a1..5ce8223 100755 --- a/.cargo-husky/hooks/pre-push +++ b/.cargo-husky/hooks/pre-push @@ -2,14 +2,5 @@ set -e -echo check -cargo run --package tool-dev -- check - -echo clippy -cargo run --package tool-dev -- clippy - -echo fmt -cargo run --package tool-dev -- fmt - -echo test -cargo run --package tool-dev -- test +echo cargo run --package tool-dev -- pre-push +cargo run --package tool-dev -- pre-push diff --git a/crates/tools/dev/src/main.rs b/crates/tools/dev/src/main.rs index bea70d2..363206d 100644 --- a/crates/tools/dev/src/main.rs +++ b/crates/tools/dev/src/main.rs @@ -18,6 +18,7 @@ enum Commands { Fmt, Build { platform: String }, Test { platform: Option }, + PrePush, } fn run(program: &str, args: &[&str]) { @@ -35,7 +36,7 @@ fn run(program: &str, args: &[&str]) { } } Err(e) => { - eprintln!("Error: {e}"); + eprintln!("Error: {e:?}"); std::process::exit(1); } } @@ -129,6 +130,13 @@ fn test(platform: Option) { } } +fn pre_push() { + check(); + clippy(); + fmt(); + test(None); +} + fn main() { let cli = Cli::parse(); match cli.command { @@ -137,6 +145,7 @@ fn main() { Some(Commands::Fmt) => fmt(), Some(Commands::Build { platform }) => build(&platform), Some(Commands::Test { platform }) => test(platform), + Some(Commands::PrePush) => pre_push(), None => { panic!("No command"); }