aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorFeoramund <161657516+Feoramund@users.noreply.github.com>2025-05-19 09:25:18 -0400
committerFeoramund <161657516+Feoramund@users.noreply.github.com>2025-05-19 09:28:17 -0400
commit4495a4c58ed73c7b6c4b552855537ead65cd93d3 (patch)
tree80aaa56c15134bcbe7935067c3b809ab9a74971d /src/main.cpp
parenta5926532a2316340e6ceed7d8a7fee2b02fde7b7 (diff)
Check for `-help` sooner and show it immediately
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f64575cac..d32ae9c28 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3282,6 +3282,16 @@ int main(int arg_count, char const **arg_ptr) {
String run_args_string = {};
isize last_non_run_arg = args.count;
+ for_array(i, args) {
+ if (args[i] == "--") {
+ break;
+ }
+ if (args[i] == "-help" || args[i] == "--help") {
+ build_context.show_help = true;
+ return print_show_help(args[0], command);
+ }
+ }
+
bool run_output = false;
if (command == "run" || command == "test") {
if (args.count < 3) {
@@ -3428,11 +3438,6 @@ int main(int arg_count, char const **arg_ptr) {
init_filename = copy_string(permanent_allocator(), init_filename);
- if (init_filename == "-help" ||
- init_filename == "--help") {
- build_context.show_help = true;
- }
-
if (init_filename.len > 0 && !build_context.show_help) {
// The command must be build, run, test, check, or another that takes a directory or filename.
if (!path_is_directory(init_filename)) {