Skip to content

Add command-line interface#109

Open
bruce965 wants to merge 1 commit into
flametime:0.2from
bruce965:cli-interface
Open

Add command-line interface#109
bruce965 wants to merge 1 commit into
flametime:0.2from
bruce965:cli-interface

Conversation

@bruce965
Copy link
Copy Markdown

Hi 🙋‍♂️

This change allows codegen from the command-line with this command:

godot path/to/project.godot --headless --script res://addons/SpacetimeDB/cli.gd

The output looks something like the following:

Godot Engine v4.6.1.stable.official.14d19694e - https://godotengine.org

(... SNIP ...)

Generated files:
res://spacetime_bindings/schema/types/spacetime_person.gd
res://spacetime_bindings/schema/tables/spacetime_person_table.gd
res://spacetime_bindings/schema/module_spacetime_client.gd
res://spacetime_bindings/schema/module_spacetime_db.gd
res://spacetime_bindings/schema/module_spacetime_reducers.gd
res://spacetime_bindings/schema/module_spacetime_types.gd
res://spacetime_bindings/schema/spacetime_autoload.gd
OK!
(... SNIP ...)

Feel free to merge if you think this could be useful. Also, I noticed you are currently refactoring, let me know if you need me to have a look again once that's done.

Thank you and wish you a good day!

add_autoload_singleton(AUTOLOAD_NAME, AUTOLOAD_PATH)
while get_editor_interface().get_resource_filesystem().is_scanning():
print_log("Waiting for auto scan to finish")
await get_tree().process_frame
Copy link
Copy Markdown
Author

@bruce965 bruce965 Mar 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was necessary to prevent the process from hanging. I assume that's because when running from the command-line it runs in single-thread mode.

Comment thread godot-client/addons/SpacetimeDB/core_types/logging.gd Outdated
@xDovos
Copy link
Copy Markdown
Collaborator

xDovos commented Mar 29, 2026

i'm almost raedy to release the V2 version of the plugin. after that i will look if this is still compatible.

@xDovos
Copy link
Copy Markdown
Collaborator

xDovos commented Apr 27, 2026

i merged my v2 changes into main, so this has now merge conflicts. can you update the PR and check that it still works as expected?

@bruce965
Copy link
Copy Markdown
Author

@xDovos it seems to still be working.

I removed my logging adapter since you already made it flexible enough with your refactoring, but I still had to add a boolean flag to force directing logs to the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants