Commit Diff


commit - f96edc2510f43ce54ae271614ea2a4d751057d23
commit + bd71caf68080238bb0f9395d28a68fa3adf3f44d
blob - 9dc01d186e7019fb0f3759684885e6b0142957af
blob + cf4db6ba9ab4776d921abba8bd3b0880820b0725
--- plass
+++ plass
@@ -51,7 +51,6 @@ my %subcmd = (
 	gen	=> [\&cmd_gen,		"[-c chars] [-l length] entry"],
 	got	=> [\&cmd_got,		"arguments ..."],
 	mv	=> [\&cmd_mv,		"from to"],
-	regen	=> [\&cmd_regen,	"[-c chars] [-l length] entry"],
 	rm	=> [\&cmd_rm,		"entry"],
 	tee	=> [\&cmd_tee,		"[-q] entry"],
 	tog	=> [\&cmd_tog,		"arguments ..."],
@@ -229,14 +228,14 @@ sub cmd_gen {
 
 	my $name = shift @ARGV;
 	my $file = name2file $name;
-	die "password already exists: $file\n" if -e $file;
+	my $renamed = -f $file;
 
 	my $pass = gen($chars, $length);
 
 	unless ($nop) {
 		writepass($file, $pass);
 		got_add $file;
-		got_ci "+$name";
+		got_ci($renamed ? "update $name" : "+$name");
 	}
 	say $pass unless $q;
 }
@@ -263,32 +262,10 @@ sub cmd_mv {
 	rename $pa, $pb or die "can't rename $a to $b: $!";
 
 	got_rm $pa;
-	got_add $pb;
+	got_add $pb or die "can't add $pb\n";
 	got_ci "mv $a $b";
 }
 
-sub cmd_regen {
-	my $chars = $default_chars;
-	my $length = $default_length;
-
-	GetOptions(
-		'c=s' => sub { $chars = $_[1] },
-		'h|?' => \&usage,
-		'l=i' => sub { $length = $_[1] },
-	    ) or usage;
-	usage if @ARGV ne 1;
-
-	my $name = shift @ARGV;
-	my $file = name2file $name;
-	die "password doesn't exist" unless -f $file;
-
-	my $pass = gen($chars, $length);
-	writepass($file, $pass);
-
-	got_add $file;
-	got_ci "regen $name";
-}
-
 sub cmd_rm {
 	GetOptions('h|?' => \&usage) or usage;
 	usage if @ARGV ne 1;
@@ -334,7 +311,7 @@ B<plass> - manage passwords
 
 B<plass> I<command> [-h] [arg ...]
 
-Valid subcommands are: cat, find, gen, got, mv, regen, rm, tee, tog.
+Valid subcommands are: cat, find, gen, got, mv, rm, tee, tog.
 
 =head1 DESCRIPTION
 
@@ -382,10 +359,6 @@ I<arguments>.
 Rename a password entry, doesn't work with directories.  I<from> must
 exist and I<to> mustn't.
 
-=item B<regen> [B<-c> I<chars>] [B<-l> I<length>] I<entry>
-
-Like B<gen> but re-generates a password in-place.
-
 =item B<rm> I<entry>
 
 Remove the password I<entry> from the store.