• Godot HelpProgramming
  • Docs for OS.get_cmdline_args should show minimal form for parsing commands with+without options

https://docs.godotengine.org/en/latest/classes/class_os.html#class-os-method-get-cmdline-args

If you run the exe with "--host --join=127.0.0.1" then arguments = {join:"127.0.0.1"} but I think it should be {host:"", join:"127.0.0.1"}.

I suggest this instead:

	var arguments = {}

	for argument in OS.get_cmdline_args():

		if argument.find("=") > -1:

			var key_value = argument.split("=")

			arguments[key_value[0].lstrip("--")] = key_value[1]

		else:

			arguments[argument.lstrip("--")] = null

It's not a dictionary, it is one argument at a time, similar to most command line apps. However, it is just a string, so you can parse it into any format you like. However, that will be confusing to users, who are used to how terminal apps have worked for the last 30 years.

7 months later