Colored output for all entries
This commit is contained in:
parent
6e32360a35
commit
0f7dcac60b
19
Database.pm
19
Database.pm
@ -49,18 +49,27 @@ sub mdo {
|
|||||||
my $sth = $dbh->prepare($q);
|
my $sth = $dbh->prepare($q);
|
||||||
my $rv = $sth->execute();
|
my $rv = $sth->execute();
|
||||||
|
|
||||||
|
use Term::ANSIColor;
|
||||||
|
printf "%-11s %-11s %-11s %-11s\n",
|
||||||
printf "%-11s %-11s %-11s %-11s\n", "ID", "NAME", "RESOURCE", "USERNAME";
|
colored( "ID", 'white' ),
|
||||||
|
colored( "NAME", 'magenta' ),
|
||||||
|
colored( "RESOURCE", 'blue' ),
|
||||||
|
colored( "USERNAME", 'green' );
|
||||||
|
print "=========================\n";
|
||||||
while ( my ( $id, $name, $resource, $username )
|
while ( my ( $id, $name, $resource, $username )
|
||||||
= $sth->fetchrow_array() )
|
= $sth->fetchrow_array() )
|
||||||
{
|
{
|
||||||
printf "%-11s %-11s %-11s %-11s\n",
|
printf "%-11s %-11s %-11s %-11s\n",
|
||||||
$id, $name, $resource, $username;
|
colored( $id, 'white' ),
|
||||||
|
colored( $name, 'magenta' ),
|
||||||
|
colored( $resource, 'blue' ),
|
||||||
|
colored( $username, 'green' );
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove unencrypted file
|
# Remove unencrypted file
|
||||||
my @rm_cmd = ( "rm", "-f", "$db_file" );
|
my @rm_cmd = ( "rm", "-f", "$db_file" );
|
||||||
system(@rm_cmd) == 0 or die "Cannot remove unencrypted database! $!\n";
|
system(@rm_cmd) == 0
|
||||||
|
or die "Cannot remove unencrypted database! $!\n";
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
pm.pl
8
pm.pl
@ -105,7 +105,13 @@ elsif ( defined($opt_s) and defined($opt_n) and defined($opt_o) ) {
|
|||||||
my @open_cmd = ( 'xdg-open', $get_h->{resource} );
|
my @open_cmd = ( 'xdg-open', $get_h->{resource} );
|
||||||
system(@open_cmd) == 0 or die "Cannot open URI: $!\n";
|
system(@open_cmd) == 0 or die "Cannot open URI: $!\n";
|
||||||
|
|
||||||
print "Password copied to clipboard. Trying to open uri.\n";
|
print color 'bold green';
|
||||||
|
print "Password copied to clipboard.\n";
|
||||||
|
print color 'reset';
|
||||||
|
print "Trying to open ";
|
||||||
|
print color 'bold blue';
|
||||||
|
print $get_h->{resource} . "\n";
|
||||||
|
print color 'reset';
|
||||||
}
|
}
|
||||||
# Remove string from db
|
# Remove string from db
|
||||||
elsif ( defined($opt_r) and defined($opt_i) ) {
|
elsif ( defined($opt_r) and defined($opt_i) ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user