mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Add xtask crate (#4293)
Replaces only the cargo_deny.sh script for now. Can be expanded over time to replace the other shell and python scripts, so only Rust is needed to work with the repository. Closes <https://github.com/emilk/egui/issues/2887> Closes <https://github.com/emilk/egui/issues/4373> --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
40
xtask/src/main.rs
Normal file
40
xtask/src/main.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
#![allow(clippy::print_stdout)]
|
||||
#![allow(clippy::print_stderr)]
|
||||
#![allow(clippy::exit)]
|
||||
|
||||
mod deny;
|
||||
pub(crate) mod utils;
|
||||
|
||||
type DynError = Box<dyn std::error::Error>;
|
||||
|
||||
fn main() {
|
||||
if let Err(e) = try_main() {
|
||||
eprintln!("{e}");
|
||||
std::process::exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
fn try_main() -> Result<(), DynError> {
|
||||
let arg_strings: Vec<_> = std::env::args().skip(1).collect();
|
||||
let args: Vec<_> = arg_strings.iter().map(String::as_str).collect();
|
||||
|
||||
match args.as_slice() {
|
||||
&[] | &["-h"] | &["--help"] => print_help(),
|
||||
&["deny", ..] => deny::deny(&args[1..])?,
|
||||
c => Err(format!("Invalid arguments {c:?}"))?,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn print_help() {
|
||||
let help = "
|
||||
xtask help
|
||||
|
||||
Subcommands
|
||||
deny: Run cargo-deny for all targets
|
||||
|
||||
Options
|
||||
-h, --help: print help and exit
|
||||
";
|
||||
println!("{help}");
|
||||
}
|
||||
Reference in New Issue
Block a user