#!/usr/bin/env perl use strict; use warnings; # run as pwsafe --exportdb | pwsafe2pass # requires an already initialized pass database # headers readline; readline; while (my $line = <>) { chomp $line; my ($uuid, $group, $name, $login, $passwd, $notes) = map { s/^"(.*)"$/$1/; # sigh s/\\\\/\\/g; s/>/>/g; # not a typo, they really forgot the ; s/</print("$passwd\n"); $fh->print("$notes\n") if $notes; $fh->close; # XXX pass doesn't propagate git failure exit codes to the overall process, # so failures in 'git add' or whatever will fail silently die "Failed to insert $entry: $?" if $?; }