godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add scaffolding functionality to the Godot binary #9306

Open adamscott opened 8 months ago

adamscott commented 8 months ago

Describe the project you are working on

Writing a tutorial for using the godot-cpp-template.

Describe the problem or limitation you are having in your project

The godot-cpp template is somewhat difficult to use. It takes into account that you create a project from scratch with the intent of having a GDExtension, which is quite specific.

Telling people to use the godot-cpp template is somewhat vain, as it would be as difficult to explain as the existing godot-cpp tutorial.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a new tool in the Godot binary that setups a project in the current directory. It could be

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Here how the Godot binary tool could work:

Tool summon

The tool could be summoned with the scaffold keyword after the binary.

$ godot scaffold

It would differ from other existing tools as --doctool as godot scaffold is intended to be felt as a command line app as its own.

Specific help

godot scaffold --help would display the scaffold help, not the general help.

The help could list all the parameters needed for each scaffold module.

Godot Engine v4.3.dev.custom_build.0cab68afd (2024-03-15 19:15:14 UTC) - https://godotengine.org
Free and open source software under the terms of the MIT license.
(c) 2014-present Godot Engine contributors. (c) 2007-present Juan Linietsky, Ariel Manzur.

Usage:
  godot scaffold [type] [options]

General options:
  -h, --help                           Display this help message.
  --version                            Display the version string.
  -v, --verbose                        Use verbose stdout mode.
  --quiet                              Quiet mode, silences stdout messages. Errors are still displayed.
  --no-header                          Do not print engine version and rendering method header on startup.
  --no-interactive                          Do not start the interactive scaffold builder.

godot type options:
  --title                               Project title.

godot-cpp type options:
  --title                               Project title.

Interactive scaffold

Launching godot scaffold without any parameters would launch the interactive scaffold tool. The builder would be launched for every missing parameter, except when --no-interactive would be added as a parameter.

Which scaffold would you like to use?
  Base Godot project
> godot-cpp project
Name of your project
> 
Project directory
(./name_of_my_project) > 

And such.

Declarative scaffold

It would be possible to pass all the parameters a scaffold needs after the scaffold keyword, bypassing the need for an interactive prompt.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This PR is in part essentially the command line equivalent of using the project manager to create a project.

Is there a reason why this should be core and not an add-on in the asset library?

This kind of functionality isn't made for the asset library.

Calinou commented 8 months ago

I think it should be an option (godot --scaffold <type> or godot --new <type>) as opposed to a subcommand, as we currently don't use any subcommands in Godot's CLI syntax.

Gallilus commented 8 months ago

About "any other bindings..." How would third-party bindings create/register their scaffold?

passivestar commented 8 months ago

Related: https://github.com/godotengine/godot-proposals/issues/9188

aaronfranke commented 7 months ago

Instead of a command-line option, I believe it should just be a button in the editor. Make it as simple as possible. This is what I've implemented in this PR https://github.com/godotengine/godot/pull/90979

Calinou commented 7 months ago

Instead of a command-line option, I believe it should just be a button in the editor. Make it as simple as possible. This is what I've implemented in this PR godotengine/godot#90979

I'd say it should be both, for automation purposes :slightly_smiling_face: