A CLI tool to generate Godot-Rust projects and scripts.
gdext-cli simplifies the process of creating and managing Godot game projects that use Rust as their scripting language via godot-rust. It automates common tasks like project initialization and script creation.
- Project Initialization: Quickly bootstrap a new Godot-Rust project with the necessary directory structure and configuration files
- Script BoilerPlate Generation: Generate Rust code for new script to bind the appropriate Godot node types
First, clone and install the CLI tool:
git clone https://github.com/FrankCasanova/gdext-cli.gitcd gdext-clicargo install --path .after that u can use the command gdext-cli to create a new project or script.
and also you can remove the cli folder if u dont want to use it anymore.
cd ..rm -rf gdext-clinow! lets start a new project first create a new folder for your game:
mkdir game_examplecd game_examplethe most easy way to start a new project is using the command:
gdext-cli template name-of-ur-gamethis command will generate a template example in the current directory like this:
game_example/
├── src/
│ ├── lib.rs
│ └── player.rs
├── Cargo.toml
└── rust.gdextension
just rename things and accomodate the starter project according to your needs.
but if u want to start a project with a script already created you can use the command:
gdext-cli startproject example-game example-game-nameThis will create the necessary directories and files for a new Godot-Rust project.
You can indicate your godot project directory by using the --godot-dir option:
# pwd -> ~/game_example/rust/
gdext-cli startproject --godot-dir ../godot example-game example-game-nameKeep in mind the Godot project directory must exist previous to executing this command.
gdext-cli script player-name-example character-body-2dThis command generates a new script with:
- A file named
player.rsin thesrcdirectory - A Rust struct named
Playerthat extends theCharacterBody2Dnode type
USAGE:
gdext-cli [SUBCOMMAND]
OPTIONS:
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
startproject Initialize a new Godot-Rust project
script Generate a new script with the given name and node type
help Print this message or the help of the given subcommand(s)
Initialize a new Godot-Rust project
Usage: gdext-cli startproject [OPTIONS] <SCRIPT> <NAME>
Arguments:
<SCRIPT>
<NAME>
Options:
--godot-dir <GODOT_DIR> The path to the Godot project directory
-h, --help Print help
USAGE:
gdext-cli script [OPTIONS] --name <NAME> --typenode <TYPENODE>
OPTIONS:
--name <NAME> The name of the script (snake_case for file, PascalCase for struct)
--typenode <TYPENODE> The Godot node type (e.g., CharacterBody3D)
gdext-cli script main-player character-body-2dgdext-cli script main-menu controlFrank Casanova
- Email: frankcasanova.info@gmail.com
- GitHub: FrankCasanova
- LinkedIn: frankcasanova
Contributions are welcome! Please feel free to submit a Pull Request.