-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for command-line user arguments. #63624
Conversation
2b43658
to
24a3788
Compare
24a3788
to
d681485
Compare
Solves #44750 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good to merge after applying suggestions.
d681485
to
937acfb
Compare
937acfb
to
bc0c998
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One issue to fix, otherwise looks fine.
The man page and shell completion files should also be updated but I guess that's something best left to closer to the 4.0 release, there are likely other new/changed options that need to be resynced.
After this I think we should look into removing support for passing unknown arguments before --
. This would solve a lot of confusion for users when they don't use the options properly and don't understand why it complains that it can't load a scene. (We could add --scene <path>
for loading scenes instead of interpreting any standalone unknown arg as a scene path.)
6ec2bdc
to
ed383b3
Compare
Implements the standard Unix double dash (--) commandline argument: * Arguments after a double dash (--) are ignored by Godot and stored for the user. * User can access them via `OS.get_cmdline_user_args()` Example: `godot.exe scene_to_run.tscn --fullscreen -- --start-level 2`
ed383b3
to
0dd6537
Compare
Thanks! |
Implements the standard Unix double dash (--) commandline argument:
OS.get_cmdline_user_args()
Example:
godot.exe scene_to_run.tscn --fullscreen -- --start-level factory
FAQ:
Q: What's wrong with using the regular Godot commandline for these things?
A: Godot has a very complex and powerful support for lots of things that can be configured via command-line arguments. As arguments can have sub-arguments or arguments used standalone (as example
godot.exe --position 20,20 scene.tscn --always-on-top
) the parser could ignore the ones it does not recognize, but then it has no idea what to do with the sub-arguments.Bugsquad edit: This closes godotengine/godot-proposals#2797 and closes #44750.