fix: show help menu when running lux with no arguments

Previously `lux` with no args entered the REPL. Now it shows the help
menu. Use `lux repl` to start the REPL explicitly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-18 07:34:09 -05:00
parent 2909bf14b6
commit 6bedd37ac7

View File

@@ -205,6 +205,10 @@ fn main() {
compile_to_c(&args[2], output_path, run_after, emit_c);
}
}
"repl" => {
// Start REPL
run_repl();
}
"doc" => {
// Generate API documentation
generate_docs(&args[2..]);
@@ -214,7 +218,7 @@ fn main() {
if !std::path::Path::new(cmd).exists() && !cmd.starts_with('-') && !cmd.contains('.') && !cmd.contains('/') {
let known_commands = vec![
"fmt", "lint", "test", "watch", "init", "check", "debug",
"pkg", "registry", "serve", "compile", "doc",
"pkg", "registry", "serve", "compile", "doc", "repl",
];
let suggestions = diagnostics::find_similar_names(cmd, known_commands.into_iter(), 2);
if !suggestions.is_empty() {
@@ -229,8 +233,8 @@ fn main() {
}
}
} else {
// Start REPL
run_repl();
// No arguments — show help
print_help();
}
}
@@ -240,7 +244,8 @@ fn print_help() {
println!();
println!("{}", bc("", "Usage:"));
println!();
println!(" {} Start the REPL", bc(colors::CYAN, "lux"));
println!(" {} Show this help", bc(colors::CYAN, "lux"));
println!(" {} Start the REPL", bc(colors::CYAN, "lux repl"));
println!(" {} {} Run a file (interpreter)", bc(colors::CYAN, "lux"), c(colors::YELLOW, "<file.lux>"));
println!(" {} {} {} Compile to native binary", bc(colors::CYAN, "lux"), bc(colors::CYAN, "compile"), c(colors::YELLOW, "<file.lux>"));
println!(" {} {} {} {} Compile with output name", bc(colors::CYAN, "lux"), bc(colors::CYAN, "compile"), c(colors::YELLOW, "<f>"), c(colors::YELLOW, "-o app"));