Show password now must be worked. But I'm not tested it.

This commit is contained in:
Difrex 2014-05-05 22:55:27 +04:00
parent a2d3c362f5
commit 8f4618b8cb
2 changed files with 19 additions and 9 deletions

View File

@ -3,10 +3,11 @@ PM
Simple password manager writed in perl. Simple password manager writed in perl.
== INSTALL == INSTALL
=======
=== Perl modules ===
Perl modules
===
cpan install Module::Name. cpan install Module::Name.
Not recommended. Please use you package manager. Not recommended. Please use you package manager.
@ -20,7 +21,7 @@ On Fedora:
On Debian-based systems: On Debian-based systems:
I'm don't have it now. I'm don't have it now :)
TODO TODO

19
pm.pl
View File

@ -7,7 +7,7 @@ use ClipPass;
# Debug # Debug
use Data::Dumper; use Data::Dumper;
our $VERSION = '0.0.1a'; our $VERSION = '0.0.1b';
sub usage() { sub usage() {
print STDERR << "EOF"; print STDERR << "EOF";
@ -69,15 +69,24 @@ init();
my $copy = ClipPass->new(); my $copy = ClipPass->new();
# Command line arguments switch # Command line arguments switch
# It's really ugly code. Sorry :(
if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) { if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) {
# Copy password to xclipboard my $get_h = $pass->show($opt_n);
print "$opt_s, $opt_n\n"; $copy->copy($get_h->{password});
print "Password copied to xclipboard.\nURI is " . $get_h->{resource};
} }
elsif ( defined($opt_s) and defined($opt_n) and defined($opt_o) ) { elsif ( defined($opt_s) and defined($opt_n) and defined($opt_o) ) {
# Copy password to xclipboard and open the uri my $get_h = $pass->show($opt_n);
print "$opt_s, $opt_n, $opt_o\n"; $copy->copy($get_h->{password});
# Open resource.
my @open_cmd = ('xdg-open', $get_h->{resource});
system(@open_cmd) == 0 or die "Cannot open URI: $!\n";
print "Password copied to clipboard. Trying to open uri.\n";
} }
elsif ( defined($opt_w) elsif ( defined($opt_w)
and defined($opt_n) and defined($opt_n)