Start working on main
This commit is contained in:
parent
d6ccfabdb3
commit
77ff0e98f1
@ -1,4 +1,4 @@
|
||||
package Clip;
|
||||
package ClipPass;
|
||||
|
||||
use Clipboard;
|
||||
|
13
Password.pm
13
Password.pm
@ -13,12 +13,9 @@ sub new {
|
||||
my $db = Database->new();
|
||||
my $gpg = GPG->new( $ENV{HOME} );
|
||||
|
||||
my $p_save = PasswordSave->new();
|
||||
my $p_show = PasswordShow->new();
|
||||
|
||||
my $self = {
|
||||
_db => $db,
|
||||
_gpg => $gpg,
|
||||
_db => $db,
|
||||
_gpg => $gpg,
|
||||
};
|
||||
|
||||
bless $self, $class;
|
||||
@ -74,7 +71,7 @@ sub save {
|
||||
my $mdo_q = {
|
||||
file => $dec_db_file,
|
||||
name => $name,
|
||||
query => $query,
|
||||
query => $q,
|
||||
type => 'do',
|
||||
};
|
||||
|
||||
@ -102,8 +99,10 @@ sub check_config {
|
||||
else {
|
||||
my $db = $self->{_db};
|
||||
$db->create_base();
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
1;
|
||||
|
45
pm.pl
45
pm.pl
@ -2,12 +2,13 @@
|
||||
|
||||
use Password;
|
||||
use Getopt::Std;
|
||||
|
||||
our $VERSION = '0.0.1a';
|
||||
use ClipPass;
|
||||
|
||||
# Debug
|
||||
use Data::Dumper;
|
||||
|
||||
our $VERSION = '0.0.1a';
|
||||
|
||||
sub usage() {
|
||||
print STDERR << "EOF";
|
||||
Simple password manager writed in Perl.
|
||||
@ -43,9 +44,12 @@ EOF
|
||||
}
|
||||
|
||||
sub init() {
|
||||
my $opt_string = 'swn:l:p:rhv';
|
||||
my $opt_string = 'swn:l:p:rhvo';
|
||||
getopts("$opt_string") or usage();
|
||||
our ( $opt_s, $opt_w, $opt_n, $opt_r, $opt_l, $opt_p, $opt_h, $opt_v, $opt_o );
|
||||
our (
|
||||
$opt_s, $opt_w, $opt_n, $opt_r, $opt_l,
|
||||
$opt_p, $opt_h, $opt_v, $opt_o
|
||||
);
|
||||
|
||||
print "Simple password manager writed in Perl.\nVersion: "
|
||||
. $VERSION
|
||||
@ -61,3 +65,36 @@ my $pass = Password->new();
|
||||
|
||||
# Don't use it's before GPG and Database
|
||||
# $pass->check_config() == 0 or die "$!\n";
|
||||
|
||||
my $copy = ClipPass->new();
|
||||
|
||||
# Command line arguments switch
|
||||
if ( defined($opt_s) and defined($opt_n) and !defined($opt_o) ) {
|
||||
|
||||
# Copy password to xclipboard
|
||||
print "$opt_s, $opt_n\n";
|
||||
}
|
||||
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";
|
||||
}
|
||||
elsif ( defined($opt_w)
|
||||
and defined($opt_n)
|
||||
and defined($opt_l)
|
||||
and !defined($opt_p) )
|
||||
{
|
||||
# Generate password and store it into DB
|
||||
print "$opt_w, $opt_n, $opt_l, $opt_p\n";
|
||||
}
|
||||
elsif ( defined($opt_w)
|
||||
and defined($opt_n)
|
||||
and defined($opt_l)
|
||||
and defined($opt_p) )
|
||||
{
|
||||
# Store new password into DB
|
||||
print "$opt_w, $opt_n, $opt_l, $opt_p\n";
|
||||
}
|
||||
else {
|
||||
print "FAIL\n" and usage;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user