diff --git a/Cargo.toml b/Cargo.toml index ff206c2..0904d21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ resolver = "2" version = "0.0.1" authors = ["Raphael Amorim "] edition = "2024" -license = "MIT" +license = "Apache-2.0 WITH LLVM-exception" keywords = ["compiler"] rust-version = "1.96.0" repository = "https://github.com/raphamorim/jam" diff --git a/crates/jam/src/main.rs b/crates/jam/src/main.rs index 906d93d..9f09d12 100644 --- a/crates/jam/src/main.rs +++ b/crates/jam/src/main.rs @@ -1,9 +1,11 @@ +mod cli; + use std::env; fn main() { let args: Vec = env::args().collect(); if args.len() < 2 { - display_help(); + cli::display_help(); return; } let command = &args[1]; @@ -12,59 +14,8 @@ fn main() { println!("0.0.1"); }, "help" | _ => { - display_help(); + cli::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 current working directory -jam test tests/unit # run tests under tests/unit -jam test tests/unit/foo.jam # run tests in a single file - "#); -}