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.
== INSTALL ==
=== Perl modules ===
INSTALL
=======
Perl modules
===
cpan install Module::Name.
Not recommended. Please use you package manager.
@ -20,7 +21,7 @@ On Fedora:
On Debian-based systems:
I'm don't have it now.
I'm don't have it now :)
TODO

19
pm.pl
View File

@ -7,7 +7,7 @@ use ClipPass;
# Debug
use Data::Dumper;
our $VERSION = '0.0.1a';
our $VERSION = '0.0.1b';
sub usage() {
print STDERR << "EOF";
@ -69,15 +69,24 @@ init();
my $copy = ClipPass->new();
# Command line arguments switch
# It's really ugly code. Sorry :(
if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) {
# Copy password to xclipboard
print "$opt_s, $opt_n\n";
my $get_h = $pass->show($opt_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) ) {
# Copy password to xclipboard and open the uri
print "$opt_s, $opt_n, $opt_o\n";
my $get_h = $pass->show($opt_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)
and defined($opt_n)