App-PS1

 view release on metacpan or  search on metacpan

lib/App/PS1/Plugin/Node.pm  view on Meta::CPAN

our $VERSION     = 0.08;
our @EXPORT_OK   = qw//;
our %EXPORT_TAGS = ();

sub node {
    my ($self, $options) = @_;
    my $version;
    my $path;

    if ( $path = $ENV{NVM_BIN} ) {
        # best guess for nvm
        ($version) = $path =~ m{/([^/]+)/bin};
    }
    elsif ( $path = $ENV{NODE_PATH} ) {
        # best guess for nave
        ($version) = $path =~ /installed.(.*?).lib/;
    }
    else {
        return;
    }

    return if !$version;

    return $self->surround( 5 + length $version, $self->colour('branch_label') . 'node ' . $self->colour('branch') . $version );
}



( run in 0.493 second using v1.01-cache-2.11-cpan-748bfb374f4 )