From 8fbdc51644d9d9db8dac39a3aa0dba726ef2309d Mon Sep 17 00:00:00 2001 From: Raphael Amorim Date: Tue, 16 Jun 2026 10:42:02 +0200 Subject: [PATCH] help menu --- crates/jam/src/main.rs | 56 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/crates/jam/src/main.rs b/crates/jam/src/main.rs index 50dd445..8a00276 100644 --- a/crates/jam/src/main.rs +++ b/crates/jam/src/main.rs @@ -3,7 +3,7 @@ use std::env; fn main() { let args: Vec = env::args().collect(); if args.len() < 2 { - displayHelp(); + display_help(); return; } let command = &args[1]; @@ -12,11 +12,59 @@ fn main() { println!("0.0.1"); }, _ => { - + display_help(); } } } -fn displayHelp() { - println!("Display help"); +fn display_help() { + println!(r#"Jam programming language compiler + +Usage: jam [OPTIONS] + jam run [LINKER-FLAGS] + jam test [] + +Subcommands: + run Compile, run, and clean up the executable. + Only linker flags (-l) may accompany it. + test Compile test functions and run them. + version Print version and exit. + help Print help and exit. + +Options: + -o Output binary name (default: 'output') + -C opt-level=N Optimization level, Default is '0' + 0 no optimizations + 1 basic optimizations + 2 LLVM default (-O2) + 3 aggressive (-O3) + s optimize for size (-Os) + z aggressively optimize for size (-Oz) + -C lto=MODE Link-time optimization. Default is 'off' + off regular object file (no LTO) + thin ThinLTO bitcode — fast, parallel link + fat full LTO bitcode — slowest link, most opt + -C strip=MODE Symbol / debug-info stripping. Default is 'none' + none keep all symbols & debug info + debuginfo strip DWARF / debug sections only + symbols strip debug + local symbols + --emit-ir Print LLVM IR to stdout + --target-info Show host target info (arch, triple, ...) + --std-path + Override the standard-library root used to + takes precedence over the JAM_STD_PATH env var + -l, --library + Link against system library + +Examples: + +jam hello.jam # compile to './output' +jam run hello.jam # compile and run +jam run -lncurses tetris.jam # compile, link with ncurses, run +jam help # show help +jam version # show version +jam test # run tests in cwd (recursive) +jam test tests/unit # run tests under tests/unit +jam test tests/unit/foo.jam # run tests in a single file + "#); } -- 2.51.2