cargo-generate / cargo-generate

cargo, make me a project

Home Page:https://cargo-generate.github.io/cargo-generate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default sub template is not automatically used in silent mode (without user interaction)

Andrew15-5 opened this issue · comments

Describe the bug

https://cargo-generate.github.io/cargo-generate/usage.html#templates-in-subfolders:

Multiple sub-templates can also be configured in the cargo-generate.toml file like this:

[template]
sub_templates = ["folder1", "folder2"]

Doing so also sets the order when cargo-generate asks what to expand, while the first option will be the default.

Running CLI in silent mode it will still ask for the sub template even if the first should be selected as a default one.

make sure you

  • I'm on the latest rust version rustup update
  • I'm on the latest cargo-generate version cargo install cargo-generate
  • In case you have an own .gitconfig, provide all sections that contains one of: insteadOf, url

To Reproduce
Steps to reproduce the behavior:

  1. cargo-generate generate -s -n name dioxuslabs/dioxus-template
  2. output it generated..
⚠   Favorite `dioxuslabs/dioxus-template` not found in config, using it as a git repository: https://github.com/dioxuslabs/dioxus-template.git
? 🤷   Which sub-template should be expanded? ›
❯ Web
  Liveview
  Fullstack
  Desktop
  TUI
  1. See error user interaction

Expected behavior
No user interaction, default sub template should be used.

Desktop (please complete the following information):

  • OS: Pop!_OS
  • Version: 22.04
  • Build tools: gnu
  • Shell: zsh
  • rustc --version: 1.80.0-nightly (1fffb2a35 2024-04-28)
  • cargo generate --version: 0.20.0