I am trying to create a template project for the dotnet CLI and I have a need to alter the format of the project name for some replacements. Specifically, convention within our domain uses a camel-case version of the project name as an identifier that needs to be stored in a configuration file.
Normally the templates perform what appears to be a pretty straightforward search/replace of the template project name to the name of the project you are creating with dotnet new. This search is case-sensitive, so it will only pick up instances of the name with the exact same casing.
However in my case, I need it to match a camel case version of the name as well, and replace it with a camel case version of the new name. Is this possible?
This reference has quite a bit of information, and this shows that there is a parameter generator that supports upper and lower case conversions, but specifically says it does not support camel casing. All I really need is the ability to change the first character from upper to lower case.
Any idea how I might be able to insert a camel case version of the project name?
Here is my experimental template.json for the upper and lower case, and command line parameter, but obviously nothing for the camel casing.
{
"$schema": "http://json.schemastore.org/template",
"identity": "TemplateTest.CSharp",
"groupIdentity": "TemplateTest.Console",
"author": "TemplateTest",
"classifications": [ "Common", "Console" ],
"name": "TemplateTest console template",
"shortName": "test",
"preferNameDirectory": true,
"tags": {
"language": "C#"
},
"sourceName": "TemplateTest",
"symbols": {
"apiname": {
"type": "parameter",
"datatype": "text",
"defaultValue": "##FIX THIS##",
"replaces": "templateTest"
},
"nameUpper": {
"type": "generated",
"generator": "casing",
"parameters": {
"source": "name",
"toLower": false
},
"replaces": "TEMPLATETEST"
},
"nameLower": {
"type": "generated",
"generator": "casing",
"parameters": {
"source": "name",
"toLower": true
},
"replaces": "templatetest"
}
}
}