Skip to content

Commit 6be1f36

Browse files
Add help message
1 parent ccf5799 commit 6be1f36

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

build_system/src/main.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ mod utils;
99
macro_rules! arg_error {
1010
($($err:tt)*) => {{
1111
eprintln!($($err)*);
12+
eprintln!();
1213
usage();
1314
std::process::exit(1);
1415
}};
1516
}
1617

1718
fn usage() {
18-
// println!("{}", include_str!("usage.txt"));
19+
println!("\
20+
Available commands for build_system:
21+
22+
prepare : Run prepare command
23+
build : Run build command
24+
--help : Show this message");
1925
}
2026

2127
pub enum Command {
@@ -31,6 +37,10 @@ fn main() {
3137
let command = match env::args().nth(1).as_deref() {
3238
Some("prepare") => Command::Prepare,
3339
Some("build") => Command::Build,
40+
Some("--help") => {
41+
usage();
42+
process::exit(0);
43+
}
3444
Some(flag) if flag.starts_with('-') => arg_error!("Expected command found flag {}", flag),
3545
Some(command) => arg_error!("Unknown command {}", command),
3646
None => {

0 commit comments

Comments
 (0)