Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added template sample 17 to rename a file #8137

Merged
merged 3 commits into from
Jun 18, 2024

Conversation

ewilliams0305
Copy link
Contributor

per closed issue #1238 a sample has been created to demonstrate renaming a file.

Problem

No available examples renaming files or demonstrating the fileRename attribute .

Solution

Created a new sample No.17 demonstrating the fileRename attribute.

Checks:

  • Sample code only, no testing required.

per closed issue dotnet#1238 a sample has been created to demonstrate renaming a file.
@ewilliams0305 ewilliams0305 requested a review from a team as a code owner June 18, 2024 12:53
@ewilliams0305
Copy link
Contributor Author

@dotnet-policy-service agree [company=""]

@ewilliams0305
Copy link
Contributor Author

@dotnet-policy-service agree

Comment on lines 2 to 25
"$schema": "http://json.schemastore.org/template",
"author": "Contoso",
"classifications": [ "Console" ],
"name": "Contoso Sample 17",
"identity": "MyProject.17.Sample.CSharp",
"groupIdentity":"MyProject.17.Sample",
"shortName": "sample17",
"tags": {
"language": "C#",
"type":"project"
},
"symbols": {
"renameFileParameter": {
"type": "parameter",
"displayName": "File name",
"description": "Renames the default FileToRename.cs to the value provided.",
"datatype": "text",
"defaultValue": "FileToRename",
"replaces": "FileToRename", // Optionally renames the text inside all files matching 'FileToRename'
"fileRename": "FileToRename" // Finds files and folders including the text 'FileToRename' and replaces it with the value stored in the 'renameFileParameter'
}
},
"sourceName": "MyProject.Con",
"preferNameDirectory":true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON doesn't officially support comments. Please remove them. Also, here's some whitespace cleanup.

Suggested change
"$schema": "http://json.schemastore.org/template",
"author": "Contoso",
"classifications": [ "Console" ],
"name": "Contoso Sample 17",
"identity": "MyProject.17.Sample.CSharp",
"groupIdentity":"MyProject.17.Sample",
"shortName": "sample17",
"tags": {
"language": "C#",
"type":"project"
},
"symbols": {
"renameFileParameter": {
"type": "parameter",
"displayName": "File name",
"description": "Renames the default FileToRename.cs to the value provided.",
"datatype": "text",
"defaultValue": "FileToRename",
"replaces": "FileToRename", // Optionally renames the text inside all files matching 'FileToRename'
"fileRename": "FileToRename" // Finds files and folders including the text 'FileToRename' and replaces it with the value stored in the 'renameFileParameter'
}
},
"sourceName": "MyProject.Con",
"preferNameDirectory":true
"$schema": "http://json.schemastore.org/template",
"author": "Contoso",
"classifications": [ "Console" ],
"name": "Contoso Sample 17",
"identity": "MyProject.17.Sample.CSharp",
"groupIdentity": "MyProject.17.Sample",
"shortName": "sample17",
"tags": {
"language": "C#",
"type": "project"
},
"symbols": {
"renameFileParameter": {
"type": "parameter",
"displayName": "File name",
"description": "Renames the default FileToRename.cs to the value provided.",
"datatype": "text",
"defaultValue": "FileToRename",
"replaces": "FileToRename",
"fileRename": "FileToRename"
}
},
"sourceName": "MyProject.Con",
"preferNameDirectory": true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I just removed and formatted the template.json, comments we included based on the 01-basic-template example comments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's interesting. 🤔 I wouldn't use that as a good example. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it was odd

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was probably my fault 😁

@MiYanni MiYanni merged commit 0ae8b68 into dotnet:main Jun 18, 2024
10 checks passed
@MiYanni
Copy link
Member

MiYanni commented Jun 18, 2024

Thanks for the contribution!

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.

3 participants