mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Add help message
This commit is contained in:
@@ -9,13 +9,19 @@
|
||||
macro_rules! arg_error {
|
||||
($($err:tt)*) => {{
|
||||
eprintln!($($err)*);
|
||||
eprintln!();
|
||||
usage();
|
||||
std::process::exit(1);
|
||||
}};
|
||||
}
|
||||
|
||||
fn usage() {
|
||||
// println!("{}", include_str!("usage.txt"));
|
||||
println!("\
|
||||
Available commands for build_system:
|
||||
|
||||
prepare : Run prepare command
|
||||
build : Run build command
|
||||
--help : Show this message");
|
||||
}
|
||||
|
||||
pub enum Command {
|
||||
@@ -31,6 +37,10 @@ fn main() {
|
||||
let command = match env::args().nth(1).as_deref() {
|
||||
Some("prepare") => Command::Prepare,
|
||||
Some("build") => Command::Build,
|
||||
Some("--help") => {
|
||||
usage();
|
||||
process::exit(0);
|
||||
}
|
||||
Some(flag) if flag.starts_with('-') => arg_error!("Expected command found flag {}", flag),
|
||||
Some(command) => arg_error!("Unknown command {}", command),
|
||||
None => {
|
||||
|
||||
Reference in New Issue
Block a user