Skip to content

Add support for cargo-generate on "cargo-gen" branch#227

Open
c-git wants to merge 24 commits into
emilk:mainfrom
c-git:create-cargo-generate-template
Open

Add support for cargo-generate on "cargo-gen" branch#227
c-git wants to merge 24 commits into
emilk:mainfrom
c-git:create-cargo-generate-template

Conversation

@c-git
Copy link
Copy Markdown
Contributor

@c-git c-git commented Apr 21, 2026

This is an implementation of idea number 2 from #169

Would love feedback on the open questions so we can see if this is good to merge as is.

Open question:

  • We need to decide what is the preferred way to set authors in the Cargo.toml. There are three options that I have found of so far.
    1. Use the built in value from cargo-generate (easiest, doesn't prompt the user just sets it based on code from cargo) (Currently using this approach)
    2. Ask the user for the value providing a default of the value we use so they'll have an idea what format to enter it in.
    3. Ask it in two parts like we currently do in the script (Matches current but do users want to set this again? Would they care?)
  • Do we need to put more effort into default values than just showing what we currently have them set to in the template? (It might be possible to do via Rhai in the hooks but I've decided to leave this alone for now unless someone thinks it's worth the effort. Not worth it to me)
  • Should we update the instructions in the readme to update the broader set of fields that we update via cargo-generate? For example the cargo generate version also does updates to the readme and name of the App struct.

TODO

  • Write rust single file script to put in placeholders
  • Add placeholder in config with default values of our current values
  • Create CI job to prepare the repo and push it to another branch
  • Update readme to explain how to use cargo-generate
    • How to install cargo-generate
    • The command to use to run cargo generate
    • How to setup the command as a favourite to make it shorter to type
  • Add a CI job on that other branch to test if the expansion works Abandoned because CI doesn't seem to trigger when expected and this isn't very important.
  • Remove test line from CI - create-cargo-generate-template # For testing

@c-git c-git force-pushed the create-cargo-generate-template branch from ca0a429 to 649d7f1 Compare April 21, 2026 03:03
@c-git
Copy link
Copy Markdown
Contributor Author

c-git commented Apr 21, 2026

Basically ready for review but need to discuss/decide on the open questions. Not sure if I should mark it as ready to review still.

c-git added 4 commits April 21, 2026 01:29
Corrected grammar and formatting in README.
Possible case for failure is incorrect update to the script of adding
new files that need placeholders and not updating the script
@c-git c-git marked this pull request as ready for review April 22, 2026 16:41
@c-git
Copy link
Copy Markdown
Contributor Author

c-git commented Apr 22, 2026

Seems to be working ok for me. I added the testing to mitigate a failure mode I discovered. If we were to add more rust files to the template then we may need to do replacements in those files as well. The added tests will at least catch those cases so we know we need to update the replacement code.

c-git added 2 commits April 22, 2026 13:41
Can't be exactly the same otherwise it will not fail any tests
May be created if run locally, won't shouldn't affect CI
as git should ignore it
@c-git
Copy link
Copy Markdown
Contributor Author

c-git commented May 4, 2026

Please let me know if there is anything I need to do.

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.

1 participant