diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2025-05-19 09:26:57 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2025-05-19 09:28:17 -0400 |
| commit | 2c25a72b45b9047862535aeb9b069292eba8a6e4 (patch) | |
| tree | c3a00dbb5928d324c6eed06b8191170716669359 /src/main.cpp | |
| parent | 4495a4c58ed73c7b6c4b552855537ead65cd93d3 (diff) | |
Make certain commands fail if passed excess arguments
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index d32ae9c28..00032c1ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3385,6 +3385,10 @@ int main(int arg_count, char const **arg_ptr) { return 1; #endif } else if (command == "version") { + if (args.count != 2) { + usage(args[0]); + return 1; + } build_context.command_kind = Command_version; gb_printf("%.*s version %.*s", LIT(args[0]), LIT(ODIN_VERSION)); @@ -3399,6 +3403,10 @@ int main(int arg_count, char const **arg_ptr) { gb_printf("\n"); return 0; } else if (command == "report") { + if (args.count != 2) { + usage(args[0]); + return 1; + } build_context.command_kind = Command_bug_report; print_bug_report_help(); return 0; @@ -3423,6 +3431,10 @@ int main(int arg_count, char const **arg_ptr) { } init_filename = args[3]; } else if (command == "root") { + if (args.count != 2) { + usage(args[0]); + return 1; + } gb_printf("%.*s", LIT(odin_root_dir())); return 0; } else if (command == "clear-cache") { |