App-Raps2
view release on metacpan or search on metacpan
my ( $file, $name ) = @_;
if ( not defined $file ) {
say STDERR "No such account: ${name}";
exit 2;
}
return;
}
sub file_must_not_exist {
my ( $file, $name ) = @_;
if ( -e $file ) {
say STDERR "Account already exists: ${name}";
exit 2;
}
return;
}
sub cmd_add {
my ($name) = @_;
if ( not $name ) {
cmd_help( 1, 'add <account>' );
}
my $pwfile = data_home('raps2') . "/${name}";
file_must_not_exist( $pwfile, $name );
$raps2->get_master_password();
my $url = $raps2->ui->read_line('URL');
my $login = $raps2->ui->read_line('Login');
my $pass = $raps2->ui->read_pw( 'Password', 1 );
my $extra = $raps2->ui->read_multiline('Additional content');
if ( length($pass) == 0 ) {
$pass = $raps2->generate_password();
( run in 0.252 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )