File & Folder re-naming via symbols...
See original GitHub issueI would like to see a way to rename targeted files and/or folders via symbol configuration.
If we are able to target “variables” inside of files, the addition of targeting asset naming might offer a more rounded experience. Because the templating engine is as flexible as it is, i.e. it does not matter what you put into your template so long as it meets the required contract, I can envision getting great use running dotnet new
inside an already existing project. In other words, bring the scope down from the project level to a level that is a component of said project.
Examples…
Consider the following file structure in your template…
- foo-folder/foo-controller.ts
- foo-folder/foo-service.ts
Hypothetically we would be able to “dotnet new
” this template to scaffold a new component inside an existing project.
Target individual assets
This would be the most granular approach…
"symbols": {
"foo-folder-rename": {
"type": "folder",
"datatype": "string",
"replaces": "foo-folder",
"defaultValue": "new-compnent",
"description": "Renames component folder"
},
"foo-controller-rename": {
"type": "file",
"datatype": "string",
"replaces": "foo-controller",
"defaultValue": "new-controller",
"description": "Renames foo-controller"
},
"foo-service-rename": {
"type": "file",
"datatype": "string",
"replaces": "foo-service",
"defaultValue": "new-service",
"description": "Renames foo-service"
}
}
Batch target
More of an aggregated approach…
"symbols": {
"component-rename" : {
"type": "folder-file",
"datatype": "string",
"replaces": "foo",
"defaultValue": "new-compnent",
"description": "Renames folder and files"
}
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
You should be able to do this now by adding
fileRename
to the parameter:Will rename file or directory path segments containing “test” to have the user’s specified value
@sayedihashimi is it possible to use the “fileRename” attribute with your sidewaffle creator somehow? Could you explain how to update my template wizard interface?