0.0.2-beta
This commit is contained in:
parent
d9ce921d41
commit
b9a9ecf3ef
23
pm.pl
23
pm.pl
@ -10,7 +10,7 @@ use Usage;
|
|||||||
# Debug
|
# Debug
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
our $VERSION = '0.0.1-beta1';
|
our $VERSION = '0.0.1';
|
||||||
|
|
||||||
my $usage = Usage->new();
|
my $usage = Usage->new();
|
||||||
|
|
||||||
@ -49,18 +49,20 @@ if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) {
|
|||||||
if ( defined( $ENV{'DISPLAY'} ) ) {
|
if ( defined( $ENV{'DISPLAY'} ) ) {
|
||||||
$copy->copy($get_pass);
|
$copy->copy($get_pass);
|
||||||
|
|
||||||
print colored("Password copied to xclipboard.", 'green');
|
print colored( "Password copied to xclipboard.", 'green' );
|
||||||
print "\nURI is ";
|
print "\nURI is ";
|
||||||
print colored($get_h->{resource} . "\n", 'bold blue');
|
print colored( $get_h->{resource} . "\n", 'bold blue' );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
print colored("Warning! Password will show to terminal!", 'red');
|
print colored( "Warning! Password will show to terminal!", 'red' );
|
||||||
print " Yes/No: ";
|
print " Yes/No: ";
|
||||||
my $ans = <STDIN>;
|
my $ans = <STDIN>;
|
||||||
chomp($ans);
|
chomp($ans);
|
||||||
print "$get_pass\n" if $ans eq "Yes";
|
print "$get_pass\n" if $ans eq "Yes";
|
||||||
print "Cancel\n" if $ans ne "Yes";
|
print "Cancel\n" if $ans ne "Yes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit 0;
|
||||||
}
|
}
|
||||||
if ( defined($opt_s) and defined($opt_g) ) {
|
if ( defined($opt_s) and defined($opt_g) ) {
|
||||||
|
|
||||||
@ -76,9 +78,9 @@ 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 colored("Password copied to clipboard.\n", 'bold green');
|
print colored( "Password copied to clipboard.\n", 'bold green' );
|
||||||
print "Trying to open ";
|
print "Trying to open ";
|
||||||
print colored($get_h->{resource} . "\n", 'bold blue');
|
print colored( $get_h->{resource} . "\n", 'bold blue' );
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove string from db
|
# Remove string from db
|
||||||
@ -87,7 +89,7 @@ elsif ( defined($opt_r) and defined($opt_i) ) {
|
|||||||
my $store_h = { id => $opt_i, };
|
my $store_h = { id => $opt_i, };
|
||||||
|
|
||||||
$pass->remove($store_h) == 0 or die "Oops! 111: pm.pl. $!\n";
|
$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)
|
elsif ( defined($opt_w)
|
||||||
and defined($opt_n)
|
and defined($opt_n)
|
||||||
@ -110,7 +112,7 @@ elsif ( defined($opt_w)
|
|||||||
|
|
||||||
$pass->save($store_h) == 0 or die "Oops! 105: pm.pl. $!\n";
|
$pass->save($store_h) == 0 or die "Oops! 105: pm.pl. $!\n";
|
||||||
$copy->copy($opt_p);
|
$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)
|
elsif ( defined($opt_w)
|
||||||
and defined($opt_n)
|
and defined($opt_n)
|
||||||
@ -131,12 +133,13 @@ elsif ( defined($opt_w)
|
|||||||
};
|
};
|
||||||
|
|
||||||
$pass->save($store_h) == 0 or die "Oops! 122: pm.pl. $!\n";
|
$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
|
# Export
|
||||||
elsif ( defined($opt_x) ) {
|
elsif ( defined($opt_x) ) {
|
||||||
$pass->export($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 {
|
else {
|
||||||
$usage->show();
|
$usage->show();
|
||||||
|
Loading…
Reference in New Issue
Block a user