Skip to content

Commit

Permalink
Add support for -h/--help arg
Browse files Browse the repository at this point in the history
Co-authored-by: Johann Hemmann <johann.hemmann@proton.me>
  • Loading branch information
HaoboGu and Urhengulas authored Oct 28, 2024
1 parent b213e4c commit 6823398
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ fn notmain() -> Result<i32> {
let raw_args = env::args().skip(1).collect::<Vec<_>>();

// If there's no argument provided, print the help message
if raw_args.is_empty()
|| (raw_args.len() == 1 && (raw_args[0] == "--help" || raw_args[0] == "-h"))
{
eprintln!("flip-link: adds zero-cost stack overflow protection to your embedded programs\nYou should not use flip-link directly from command line, use flip-link as your default linker instead. \n\nFor detailed usage, check https://github.com/knurling-rs/flip-link");
if matches!(a.as_slice(), [] | ["--help" | "-h"]) {
eprintln!(
"flip-link: adds zero-cost stack overflow protection to your \
embedded programs\nYou should not use flip-link directly from \
command line, use flip-link as your default linker instead. \n\n\
For detailed usage, check https://github.com/knurling-rs/flip-link"
);
return Ok(0);
}

Expand Down

0 comments on commit 6823398

Please sign in to comment.