dolmen / angel-PS1

Your fancy shell prompt fed by your guardian angel
https://twitter.com/nglPS1
GNU Affero General Public License v3.0
61 stars 4 forks source link

plenv plugin #7

Open dolmen opened 10 years ago

dolmen commented 10 years ago

Report the current perl version set by plenv.

Design idea: use Unicode superscripts and subscripts.

$ perl -C -E 'say "perl 5.10.1: \x{2075}10\x{2081}"'
perl 5.10.1: ⁵10₁
dolmen commented 8 years ago
sub pack_perl5_version
{
    my $v = shift;
    # Replace "5." with '⁵'
    substr($v, 0, 2, "\N{U+2075}");
    # Replace minor with subscript digit
    substr($v, -2, 2, chr(0x2080+substr($v, -1)));
    $v
}