Skip to content

Instantly share code, notes, and snippets.

@zoffixznet
Created April 29, 2016 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoffixznet/d92b53015d4f4bdd0a6a5461bd0720f1 to your computer and use it in GitHub Desktop.
Save zoffixznet/d92b53015d4f4bdd0a6a5461bd0720f1 to your computer and use it in GitHub Desktop.
^C
zoffix@zoffix-VirtualBox:~/CPANPRC/party$ cat /home/zoffix/.rakudobrew/moar-nom/install/share/perl6/site/bin/rebailador
#!/usr/bin/env perl6
sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
shift @*ARGS if $name;
shift @*ARGS if $auth;
shift @*ARGS if $ver;
$name //= 'Bailador::Dev::AutoRestarter';
my @installations = $*REPO.repo-chain.grep(CompUnit::Repository::Installable);
my @binaries = sort { $^b<ver> cmp $^a<ver> }, flat @installations.map: { .files('bin/rebailador', :$name, :$auth, :$ver) };
.say for @binaries;
unless +@binaries {
@binaries = flat @installations.map: { .files('bin/rebailador') };
if +@binaries {
note q:to/SORRY/;
===SORRY!===
No candidate found for 'rebailador' that match your criteria.
Did you perhaps mean one of these?
SORRY
my %caps = :name(['Distribution', 12]), :auth(['Author(ity)', 11]), :ver(['Version', 7]);
for @binaries -> $dist {
for %caps.kv -> $caption, @opts {
@opts[1] = max @opts[1], ($dist{$caption} // '').Str.chars
}
}
note ' ' ~ %caps.values.map({ sprintf('%-*s', .[1], .[0]) }).join(' | ');
for @binaries -> $dist {
note ' ' ~ %caps.kv.map( -> $k, $v { sprintf('%-*s', $v.[1], $dist{$k} // '') } ).join(' | ')
}
}
else {
note "===SORRY!===\nNo candidate found for 'rebailador'.\n";
}
exit 1;
}
exit run($*EXECUTABLE, @binaries[0].hash.<files><bin/rebailador>, @*ARGS).exitcode
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment