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 multiple license files #21

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Conversation

MattKiazyk
Copy link
Contributor

Not all repo's have the specific LICENSE file that AckGen is searching for. Sometimes, license files are named LICENSE.txt

This adds a slight refactor to loop through a list of license files (LICENSE, LICENSE.txt) in the CLI. Future this could be added as an input parameter.

An example of a license with the txt extension is https://github.com/apple/swift-algorithms

Copy link
Owner

@MartinP7r MartinP7r left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you for your contribution!

We might need to expect other file names as well, though 🤔. Like md

let new = Acknowledgement(title: pkgDir, license: String(data: data, encoding: .utf8)!)
acknowledgements.append(new)
for file in licenseFiles {
guard let data = fman.contents(atPath: "\(packageCachePath)/\(pkgDir)/\(file)") else { continue }
Copy link
Owner

Choose a reason for hiding this comment

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

[nit]
It doesn't matter for two elements, but usually I would prefer if let with an early break to prevent unnecessary loop iterations.

@MartinP7r MartinP7r merged commit 9a87c13 into MartinP7r:main Apr 26, 2024
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.

2 participants