Skip to content

Add year to project template variables #3795

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

Merged
merged 2 commits into from
Mar 6, 2017
Merged

Conversation

jryans
Copy link
Contributor

@jryans jryans commented Mar 3, 2017

This adds the current year as a year variable for project templates. Some license files / headers include the year, so this should make it easier to include those in a template.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexcrichton
Copy link
Member

I wonder, is there perhaps a way to learn about the current year without pulling in all of chrono/time?

@jryans
Copy link
Contributor Author

jryans commented Mar 3, 2017

I wonder, is there perhaps a way to learn about the current year without pulling in all of chrono/time?

Good question! (New to Rust, so I just grabbed chrono at first as suggested by the stdx repo.)

Looks like we can peel away one layer at least and use time only, with something like:

(time::now().tm_year + 1900).to_string()

@alexcrichton, would that be acceptable? I think if we try to dump time as well, we'd have to handle OS specific time formats, so keeping the time dependency seems nice to avoid that work here.

@alexcrichton
Copy link
Member

@jryans yeah seems reasonable to me! I suspect time is the "lowest level" for now that's reasonable to start out with

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Contributor

bors commented Mar 6, 2017

📌 Commit 47221e9 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Mar 6, 2017

⌛ Testing commit 47221e9 with merge 3bc8865...

bors added a commit that referenced this pull request Mar 6, 2017
Add year to project template variables

This adds the current year as a `year` variable for project templates. Some license files / headers include the year, so this should make it easier to include those in a template.
@bors
Copy link
Contributor

bors commented Mar 6, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 3bc8865 to master...

@bors bors merged commit 47221e9 into rust-lang:master Mar 6, 2017
@ehuss ehuss added this to the 1.17.0 milestone Feb 6, 2022
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.

5 participants