Skip to content

Instantly share code, notes, and snippets.

@s1037989
Created September 1, 2022 00:49
Show Gist options
  • Save s1037989/28cbeb31813c88eb5b4edaa8c1dc3cb0 to your computer and use it in GitHub Desktop.
Save s1037989/28cbeb31813c88eb5b4edaa8c1dc3cb0 to your computer and use it in GitHub Desktop.
$ perl -Mojo -E '
c(1,2,3)
->tap(sub{@$_ = (
{properties => {release => ["QQ_2022.08.1_rc1"], commit => [1]}},
{properties => {release => ["QQ_2022.08.1"]}},
{properties => {release => ["QQ_2022.07.1"]}}
)})
->map(sub{[
((grep { /^QQ_2022.08.1(_rc\d+)?$/ } @{$_->{properties}->{release}})[0]||undef),
((grep { $_ eq "1" } @{$_->{properties}->{commit}})[0]||undef)
]})
->grep(sub{
$_->[0] && $_->[0] =~ /^QQ_2022.08.1(_rc\d+)?$/
})
->sort(sub{
$a->[0] cmp $b->[0]
})
#->tap(sub{})
->each(sub{say j($_)})
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment