Godot: Validate engine command line arguments

Created on 6 Jul 2018  路  4Comments  路  Source: godotengine/godot

It was mentioned in https://github.com/godotengine/godot/issues/19683 that Godot currently does not validate engine command line arguments.

For this to be done, Godot needs to make sure project-specific arguments are not counted as invalid (as far as I know, it cannot perform that check while initializing, even if started inside a project). Engine arguments would have to be passed before a -- sequence, and project-specific arguments would be placed after the same sequence. This is common practice in some programs that accept "general" CLI arguments in addition to arguments specific to a project.

This would break compatibility with scripts that run projects with project-specific arguments, but ensures a strict separation between engine arguments and project-specific arguments. This would also prevent any conflicts that could arise between those kinds of arguments.

enhancement core

Most helpful comment

Would it be possible to introduce a configuration variable for the project that disables the engine specific command line arguments completely?

This would mean moving the detection of the mainpack and the loading of the configuration before processing the rest of the arguments.

This would very useful if you want to give your game/software a proper command line interface. Requiring the -- is not optimal for that. Especially when you want to overload arguments like "--help" for example.

All 4 comments

Nice issue number, :+1: :cry:

I've started to implement a concept for this, I'm creating a WIP PR soon so we can discuss about the design.
I've written a few command parsers and this one is quite simple. Arround 210 lines of which 70 are for the help message creation alone as it creates the message based on the defined commands and its descriptions. It splits lines exceeding 80 characters and aligns content too.

Edit: I've still not implemented the mentioned separation of engine arguments from project arguments as I'd like to clarify the syntax for that.

Would it be possible to introduce a configuration variable for the project that disables the engine specific command line arguments completely?

This would mean moving the detection of the mainpack and the loading of the configuration before processing the rest of the arguments.

This would very useful if you want to give your game/software a proper command line interface. Requiring the -- is not optimal for that. Especially when you want to overload arguments like "--help" for example.

I think API-Beast has basically the right idea, but rather than being a project option it should be a build option. That way you can decide for a given build whether or not to include the engine's command-line options or not. They would always be enabled in the editor. When they are, then the "--" symbol will work as described by the original poster.

That being said, and not having looked through Godot's source yet, it might be difficult to run the game under some circumstances if the engine's command-line options are disabled since the engine will have already started up before the command-line processing occurs. Though how big of an issue this will be in practice, I have no idea.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RebelliousX picture RebelliousX  路  3Comments

timoschwarzer picture timoschwarzer  路  3Comments

gonzo191 picture gonzo191  路  3Comments

blurymind picture blurymind  路  3Comments

Spooner picture Spooner  路  3Comments