summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/raps25
-rw-r--r--lib/App/Raps2.pm18
2 files changed, 23 insertions, 0 deletions
diff --git a/bin/raps2 b/bin/raps2
index aef2b5a..3847457 100755
--- a/bin/raps2
+++ b/bin/raps2
@@ -19,6 +19,7 @@ $raps2->load_config();
given ($action) {
when ('add') { $raps2->cmd_add(@args) }
+ when ('del') { $raps2->cmd_remove(@args) }
when ('dump') { $raps2->cmd_dump(@args) }
when ('get') { $raps2->cmd_get(@args) }
when ('info') { $raps2->cmd_info(@args) }
@@ -59,6 +60,10 @@ Adds I<account> to the store. It will ask you for the store's master
password, some metadata and the new password and then store them. Note that
only the password is encrypted, the metadata is saved as clear-text.
+=item B<del> I<account>
+
+Remove I<account> from the store.
+
=item B<dump> I<account>
Dump everything saved for I<account>, including the clear-text password, to
diff --git a/lib/App/Raps2.pm b/lib/App/Raps2.pm
index 50d7005..273abee 100644
--- a/lib/App/Raps2.pm
+++ b/lib/App/Raps2.pm
@@ -346,6 +346,24 @@ sub cmd_list {
}
}
+=item $raps2->cmd_remove(I<$name>)
+
+Remove (unlink) the account I<name>.
+
+=cut
+
+sub cmd_remove {
+ my ($self, $name) = @_;
+ my $pwfile = $self->{xdg_data} . "/${name}";
+
+ if (-e $pwfile) {
+ unlink($pwfile);
+ }
+ else {
+ say STDERR 'File did not exist, so could not be removed';
+ }
+}
+
=back
=head1 DEPENDENCIES