Skip to content

Conversation

@taboege
Copy link
Member

@taboege taboege commented Sep 18, 2019

The script creation date is obtained from the git history. Resolves #361.

The script creation date is obtained from the git history. Resolves Raku#361.
@taboege
Copy link
Member Author

taboege commented Sep 18, 2019

I'm not completely satisfied with how the question is answered yet in that a creation date is not a good answer for an age query. I'd like to have something like "$y years and $d days ago", but I got lost a little in (leap) date arithmetic. Sadly using a Duration will be inaccurate as a difference of 366 days might be "1 year" or "1 year and 1 day", depending on what the two dates were...

But I want to ask first: Do you agree that an answer formatted like above is more desirable than the creation timestamp?

@AlexDaniel
Copy link
Member

There's a time-left sub, maybe it can be extended/repurposed to talk about dates in the past? Yes, I think “X years, etc.” is a better format. Also if it happens that it prints “…, Z seconds” too, I totally don't mind 😂

Sadly using a Duration will be inaccurate

First I was a bit confused, now I understand that you're totally right… hmm… Is there any module in the ecosystem? Generally I don't want any more dependencies in whateverable, there are already too many, but I can do an exception… :)

with birthday {
I was created on $_
}
else {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed? Bots automatically gist uncaught exceptions, there's no need. You can of course grumble ‘something went wrong’ but I don't see any good reason. In this case exception is totally fine, although I'm a bit confused as to when it'll trigger given that ‘no birthday data available’ message is there? Maybe wrap the whole thing in a try/catch and just output ‘no birthday data available no matter what goes wrong? The feature is more like an easter egg, so I'm not too concerned about debugging.

Also, change it to ‘I don't remember’, I think that's funnier.

}
#| Get the oldest commit DateTime for $*PROGRAM. Needs $*CWD to point to the whateverable git repository.
sub term:<birthday> {
my $dates = run :out, git, log, --follow, --date-order, --format=%aI, $*PROGRAM.relative;
Copy link
Member

@AlexDaniel AlexDaniel Sep 18, 2019

Choose a reason for hiding this comment

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

I used to write run like this, but nowadays I'd do run :out, <git log --follow --date-order --format=%aI>, $*PROGRAM.relative.

@AlexDaniel
Copy link
Member

AlexDaniel commented Nov 23, 2019

Any updates? :) I'd love to merge this.

@AlexDaniel AlexDaniel added all bots Issues affecting all (or most) of the bots whateverable Issues affecting the bot framework (and therefore all of the bots) labels Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

all bots Issues affecting all (or most) of the bots whateverable Issues affecting the bot framework (and therefore all of the bots)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How old are you?

2 participants