Skip to content

how to use conditional for template? #743

Answered by pplmx
pplmx asked this question in Q&A
Discussion options

You must be logged in to vote

After renaming all variables: replace - with _
It works fine.

FYI. Here is my final config.
[template]
cargo_generate_version = ">=0.10.0"

[placeholders.gh_uname]
type = "string"
prompt = "GitHub username (or organization)?"
# The username cannot end with a hyphen, too, but
# this requirement is not captured by the regex at the moment.
regex = "^[A-Za-z0-9][A-Za-z0-9-]{0,38}$"

[placeholders.proj_description]
type = "string"
prompt = "Project description?"

[placeholders.cmake_min_version]
type = "string"
prompt = "CMake minimum version?"
regex = "^[0-9]+(\\.[0-9]+){0,2}$"

[placeholders.cxx_standard_version]
type = "string"
prompt = "Cxx standard version?"
regex = "^[0-9]+$"

[placehol…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pplmx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant