summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-10-31 13:39:58 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-10-31 13:39:58 +0100
commita337b9b6ec90a4befb4ed0c82ccf5f6602261efe (patch)
tree5c0c7d13232bb73bde8cf44074090ef9e1dc6396
parent33dd947649338ac561afac3f457e9b77dc3de57c (diff)
add primitive raps2 dump-all command
-rwxr-xr-xbin/raps239
1 files changed, 32 insertions, 7 deletions
diff --git a/bin/raps2 b/bin/raps2
index 763ffaa..6c70a5d 100755
--- a/bin/raps2
+++ b/bin/raps2
@@ -135,6 +135,30 @@ sub cmd_dump {
return;
}
+sub cmd_dump_all {
+ my @files = read_dir( data_home('raps2') );
+
+ $raps2->get_master_password();
+
+ for my $file (@files) {
+ my $key = $raps2->pw_load( file => data_files("raps2/${file}") );
+
+ $raps2->ui->output(
+ [ 'Key', $file ],
+ [ 'URL', $key->{url} ],
+ [ 'Login', $key->{login} ],
+ [ 'Password', $key->{password} ],
+ );
+ if ( $key->{extra} ) {
+ print $key->{extra};
+ }
+
+ print "\n";
+ }
+
+ return;
+}
+
sub cmd_edit {
my ($name) = @_;
@@ -261,13 +285,14 @@ sub cmd_remove {
}
given ($action) {
- when ('add') { cmd_add(@args) }
- when ('del') { cmd_remove(@args) }
- when ('dump') { cmd_dump(@args) }
- when ('edit') { cmd_edit(@args) }
- when ('get') { cmd_get(@args) }
- when ('info') { cmd_info(@args) }
- when ('list') { cmd_list(@args) }
+ when ('add') { cmd_add(@args) }
+ when ('del') { cmd_remove(@args) }
+ when ('dump') { cmd_dump(@args) }
+ when ('dump-all') { cmd_dump_all(@args) }
+ when ('edit') { cmd_edit(@args) }
+ when ('get') { cmd_get(@args) }
+ when ('info') { cmd_info(@args) }
+ when ('list') { cmd_list(@args) }
default { cmd_help(1) }
}