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

Support adding license header in .txt, .patch and .tmpl files #106

Open
maqiuyujoyce opened this issue Apr 15, 2022 · 5 comments
Open

Support adding license header in .txt, .patch and .tmpl files #106

maqiuyujoyce opened this issue Apr 15, 2022 · 5 comments

Comments

@maqiuyujoyce
Copy link

Hi, can addlicense support adding the license header to .txt, .patch and .tmpl files? Or is it intentional to not support these use cases?

We want to use addlicense to add the license header to various types of files automatically and we're willing to contribute if it is not a design decision to not support them.

@bryanloz-xilinx
Copy link
Contributor

Agree, this would be very useful for common files such as CMakeLists.txt where # can be used for comment.

@willnorris
Copy link
Collaborator

addlicense already handles cmakelists.txt files, or at least it's supposed to: https://github.com/google/addlicense/blob/master/main.go#L311-L314 Does that not work?

We certainly wouldn't want to add headers to all .txt files, which is why cmakelists.txt is handled the way it is (looking for the full name)

I'm not sure what a .tmpl file would even be... I worry that that is used to generically mean "template file" for all sorts of underlying file types. Is it an HTML file? Something else?

.patch could possibly work, but aren't there different patch formats? Do they all support the same comment style?

@bryanloz-xilinx
Copy link
Contributor

bryanloz-xilinx commented Jul 22, 2022

@willnorris it wasn't working for me. Maybe there is a case sensitivity issue here? I don't know why, but historically CMake projects use CMakeLists.txt by convention.

P.S. thanks for providing this tool. It saved me a lot of time even though it didn't work exactly how I wanted it to.

@maqiuyujoyce
Copy link
Author

Thank you for the response, @willnorris ! And sorry for the delayed follow-up.

We certainly wouldn't want to add headers to all .txt files, which is why cmakelists.txt is handled the way it is (looking for the full name)

Gotcha!

I'm not sure what a .tmpl file would even be... I worry that that is used to generically mean "template file" for all sorts of underlying file types. Is it an HTML file? Something else?

I think in our use case, it is a custom template file used to generated markdown files. So it's technically a generic template file.

.patch could possibly work, but aren't there different patch formats? Do they all support the same comment style?

Possibly! So do you think it's reasonable to support the configuration of additional extensions and comment styles need for the additional extensions to fit different use cases? E.g. --add-extension ".patch" --style pound --add-extension ".txt" --style double-slash.

@basickarl
Copy link

basickarl commented Aug 14, 2023

I just spent an hour trying to figure out why nothing was being added. Not only that but files with a file extension are also ignored for some weird reason. This needs to be more clear in the documentation guys.

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 a pull request may close this issue.

4 participants