luaur_compile_cli/functions/
display_help.rs1use core::ffi::c_char;
2
3#[allow(non_snake_case)]
4pub fn display_help(argv0: *const c_char) {
5 unsafe {
6 let argv0_str = core::ffi::CStr::from_ptr(argv0).to_string_lossy();
8 std::print!("Usage: {} [--mode] [options] [file list]\n", argv0_str);
9 std::print!("\n");
10 std::print!("Available modes:\n");
11 std::print!(" binary, text, remarks, codegen, codegenir, codegenasm, codegenverbose, codegennull, null\n");
12 std::print!("\n");
13 std::print!("Available options:\n");
14 std::print!(" -h, --help: Display this usage message.\n");
15 std::print!(" -O<n>: compile with optimization level n (default 1, n should be between 0 and 2).\n");
16 std::print!(
17 " -g<n>: compile with debug level n (default 1, n should be between 0 and 2).\n"
18 );
19 std::print!(" --target=<target>: compile code for specific architecture (a64, x64, a64_nf, x64_ms).\n");
20 std::print!(" --timetrace: record compiler time tracing information into trace.json\n");
21 std::print!(" --record-stats=<granularity>: granularity of compilation stats (total, file, function).\n");
22 std::print!(" --bytecode-summary: Compute bytecode operation distribution.\n");
23 std::print!(
24 " --dump-constants: Dump constant table for each function (text mode only).\n"
25 );
26 std::print!(" --stats-file=<filename>: file in which compilation stats will be recored (default 'stats.json').\n");
27 std::print!(
28 " --vector-lib=<name>: name of the library providing vector type operations.\n"
29 );
30 std::print!(" --vector-ctor=<name>: name of the function constructing a vector value.\n");
31 std::print!(" --vector-type=<name>: name of the vector type.\n");
32 std::print!(" --only-parse: Only parse the input.\n");
33 std::print!(" --parse-cst: Whether parser should parse CST in addition to AST.\n");
34 std::print!(" --fflags=<flags>: comma-separated list of fast flags to enable/disable (--fflags=true,false,LuauFlag1=true,LuauFlag2=false).\n");
35 }
36}