diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-28 08:40:14 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-28 08:40:14 +0100 |
commit | 5eeb6e5906ebf303ba695bc26f87b41ab1b85200 (patch) | |
tree | e4fb9f60638cf6537574a6418d660b2cd11f6a7c | |
parent | f4faa507d4fbf9c823f8b1655b5aea867d954e33 (diff) | |
parent | 914d3e1b1db58731b72be57cde46158720e73cb9 (diff) |
Merge pull request #68532 from Calinou/cmdline-user-args-add-alternative-separator
Allow `++` as an alternative separator to `--` for user CLI arguments
-rw-r--r-- | doc/classes/OS.xml | 4 | ||||
-rw-r--r-- | main/main.cpp | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index ea9b83d2aa..610f77e3d8 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -182,10 +182,12 @@ <method name="get_cmdline_user_args"> <return type="PackedStringArray" /> <description> - Similar to [method get_cmdline_args], but this returns the user arguments (any argument passed after the double dash [code]--[/code] argument). These are left untouched by Godot for the user. + Similar to [method get_cmdline_args], but this returns the user arguments (any argument passed after the double dash [code]--[/code] or double plus [code]++[/code] argument). These are left untouched by Godot for the user. [code]++[/code] can be used in situations where [code]--[/code] is intercepted by another program (such as [code]startx[/code]). For example, in the command line below, [code]--fullscreen[/code] will not be returned in [method get_cmdline_user_args] and [code]--level 1[/code] will only be returned in [method get_cmdline_user_args]: [codeblock] godot --fullscreen -- --level 1 + # Or: + godot --fullscreen ++ --level 1 [/codeblock] </description> </method> diff --git a/main/main.cpp b/main/main.cpp index 460c73ceee..5a640a9d55 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -318,7 +318,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print("\n"); OS::get_singleton()->print("Run options:\n"); - OS::get_singleton()->print(" -- Separator for user-provided arguments. Following arguments are not used by the engine, but can be read from `OS.get_cmdline_user_args()`.\n"); + OS::get_singleton()->print(" --, ++ Separator for user-provided arguments. Following arguments are not used by the engine, but can be read from `OS.get_cmdline_user_args()`.\n"); #ifdef TOOLS_ENABLED OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); @@ -1288,7 +1288,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph goto error; } - } else if (I->get() == "--") { + } else if (I->get() == "--" || I->get() == "++") { adding_user_args = true; } else { main_args.push_back(I->get()); |