Godot CLI parser is an addon for godot that facilitates the creation of an end user command line interface for your godot application. Essentially, if you want to quickly and easily define discreet paramaterized commands that can be run directly off your application, Godot CLI Parser can help. This is especially helpful for allowing users to run up their own dedicated game servers, but can be broadly applied across any number of other use cases.
Add the godot-cli-parser folder to your addons/ folder in godot.
You should next create a new scene called entrypoint.tscn
and attach a script to the root node.
This script should be similar to entrypoint.gd, containing the following boilerplate:
extends Node
class commands:
extends Node
# Add commands here!
func _ready() -> void:
var c = commands.new()
var result: Dictionary = parser.run(c)
c.queue_free()
# Handle any returned errors. (will pass if result is OK)
if result.error:
print(error_string(result.error) + ": " + result.message)
get_tree().quit()
Next, add any relevant commands under the commands class.
Now, via godot's included CLI,
you can go ahead and run godot entrypoint.tscn --headless -- command arg1 arg2
, and the command and arguments will be passed through.
Contributions are welcome! Please feel free to open an issue!