Work better if $? is missing

This commit is contained in:
Emmanuel BENOîT 2020-10-19 21:28:49 +02:00
parent e61cd1495f
commit ab468beb64

5
spp.pl
View file

@ -1,5 +1,6 @@
#!/usr/bin/perl
# Shiny perl prompt, lol
# SHINY PERL PROMPT, lol
# Use with : export PROMPT_COMMAND='eval "$(perl path/to/spp.pl $?)"'
use strict;
use warnings;
@ -490,7 +491,7 @@ sub render_prevcmd
my ( $ss , $sc , $pc , $cl ) = map {
$CONFIG{ "pcmd_$_" }
} qw( show_symbol show_code pad_code colors );
my $status = $ARGV[0];
my $status = scalar(@ARGV) ? $ARGV[0] : 255;
$sc = ( $sc == 1 || ( $sc == 2 && $status ) );
return () unless $sc || $ss;