diff --git a/pm.pl b/pm.pl index c9e2161..84ac2e7 100755 --- a/pm.pl +++ b/pm.pl @@ -10,7 +10,7 @@ use Usage; # Debug use Data::Dumper; -our $VERSION = '0.0.1-beta1'; +our $VERSION = '0.0.1'; my $usage = Usage->new(); @@ -49,23 +49,25 @@ if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) { if ( defined( $ENV{'DISPLAY'} ) ) { $copy->copy($get_pass); - print colored("Password copied to xclipboard.", 'green'); + print colored( "Password copied to xclipboard.", 'green' ); print "\nURI is "; - print colored($get_h->{resource} . "\n", 'bold blue'); + print colored( $get_h->{resource} . "\n", 'bold blue' ); } else { - print colored("Warning! Password will show to terminal!", 'red'); + print colored( "Warning! Password will show to terminal!", 'red' ); print " Yes/No: "; my $ans = ; chomp($ans); print "$get_pass\n" if $ans eq "Yes"; print "Cancel\n" if $ans ne "Yes"; } + + exit 0; } if ( defined($opt_s) and defined($opt_g) ) { $pass->show( $opt_n, '', $opt_g ); - + } elsif ( defined($opt_s) and defined($opt_n) and defined($opt_o) ) { @@ -76,9 +78,9 @@ elsif ( defined($opt_s) and defined($opt_n) and defined($opt_o) ) { my @open_cmd = ( 'xdg-open', $get_h->{resource} ); system(@open_cmd) == 0 or die "Cannot open URI: $!\n"; - print colored("Password copied to clipboard.\n", 'bold green'); + print colored( "Password copied to clipboard.\n", 'bold green' ); print "Trying to open "; - print colored($get_h->{resource} . "\n", 'bold blue'); + print colored( $get_h->{resource} . "\n", 'bold blue' ); } # Remove string from db @@ -87,7 +89,7 @@ elsif ( defined($opt_r) and defined($opt_i) ) { my $store_h = { id => $opt_i, }; $pass->remove($store_h) == 0 or die "Oops! 111: pm.pl. $!\n"; - print colored("Password was removed!\n", 'bold red'); + print colored( "Password was removed!\n", 'bold red' ); } elsif ( defined($opt_w) and defined($opt_n) @@ -110,7 +112,7 @@ elsif ( defined($opt_w) $pass->save($store_h) == 0 or die "Oops! 105: pm.pl. $!\n"; $copy->copy($opt_p); - print colored("Password was stored into DB!\n", 'green'); + print colored( "Password was stored into DB!\n", 'green' ); } elsif ( defined($opt_w) and defined($opt_n) @@ -131,12 +133,13 @@ elsif ( defined($opt_w) }; $pass->save($store_h) == 0 or die "Oops! 122: pm.pl. $!\n"; - print colored("Password was stored into DB!\n", 'green'); + print colored( "Password was stored into DB!\n", 'green' ); } + # Export elsif ( defined($opt_x) ) { $pass->export($opt_x); - print colored("Dabase stored in $opt_x\n", 'green'); + print colored( "Dabase stored in $opt_x\n", 'green' ); } else { $usage->show();