diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-06-01 13:29:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-01 13:29:46 +0200 |
commit | 6c1d71edc4a41c9ad89922fc433e617a813e4658 (patch) | |
tree | d6322d1f3eaaeb38d9e9e5f44bd30528fd29e03f | |
parent | 1820f9752dd258f81d18e2940a9a9d1c13216985 (diff) | |
parent | 33909723735261991acccb6f1d3756e3659533d9 (diff) |
Merge pull request #19280 from clktmr/master
Add cli paramerter --check-only for script parsing
-rw-r--r-- | main/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 70713e2dd8..119d1ee345 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -263,6 +263,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print("Standalone tools:\n"); OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); + OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n"); #ifdef TOOLS_ENABLED OS::get_singleton()->print(" --export <target> Export the project using the given export target. Export only main pack if path ends with .pck or .zip'.\n"); OS::get_singleton()->print(" --export-debug <target> Like --export, but use debug template.\n"); @@ -1239,6 +1240,7 @@ bool Main::start() { String test; String _export_preset; bool export_debug = false; + bool check_only = false; main_timer_sync.init(OS::get_singleton()->get_ticks_usec()); @@ -1261,6 +1263,8 @@ bool Main::start() { bool parsed_pair = true; if (args[i] == "-s" || args[i] == "--script") { script = args[i + 1]; + } else if (args[i] == "--check-only") { + check_only = true; } else if (args[i] == "--test") { test = args[i + 1]; #ifdef TOOLS_ENABLED @@ -1383,6 +1387,10 @@ bool Main::start() { ERR_EXPLAIN("Can't load script: " + script); ERR_FAIL_COND_V(script_res.is_null(), false); + if (check_only) { + return false; + } + if (script_res->can_instance() /*&& script_res->inherits_from("SceneTreeScripted")*/) { StringName instance_type = script_res->get_instance_base_type(); |