Commit Diff


commit - 2c63e741e49d8c6e2acb1994768106ef131865aa
commit + 8bd06def3ffe5c08906a5a03583b6dd6579a8f96
blob - 3092e61f76f6b8a639d3bc5230a863610eabf589
blob + 7a521f34ce2146042c0715b877be8465f7509cae
--- plass
+++ plass
@@ -239,19 +239,22 @@ sub cmd_gen {
 		'n'   => \$nop,
 		'q'   => \$q,
 	    ) or usage;
+
+	my $pass = gen($chars, $length);
+	if ($nop) {
+		say $pass;
+		return;
+	}
+
 	usage if @ARGV != 1;
 
 	my $name = shift @ARGV;
 	my $file = name2file $name;
 	my $renamed = -f $file;
 
-	my $pass = gen($chars, $length);
-
-	unless ($nop) {
-		writepass($file, $pass);
-		got_add $file;
-		got_ci($renamed ? "update $name" : "+$name");
-	}
+	writepass($file, $pass);
+	got_add $file;
+	got_ci($renamed ? "update $name" : "+$name");
 	say $pass unless $q;
 }
 
blob - 36be54ad31126e498ac1517f75ffe148ce57fcb3
blob + c0c7f97c581c23bf9b5a3e8165e6e928e92e0875
--- plass.1
+++ plass.1
@@ -51,7 +51,7 @@ in the given order.
 Print one per line all the entries of the store, optionally filtered
 by the given
 .Ar pattern .
-.It Cm gen Oo Fl nq Oc Oo Fl c Ar chars Oc Oo Fl l Ar length Oc Ar entry
+.It Cm gen Oo Fl nq Oc Oo Fl c Ar chars Oc Oo Fl l Ar length Oc Op Ar entry
 Generate and persist a password for the given
 .Ar entry
 in the store.
@@ -71,7 +71,9 @@ flag is provided,
 prints the generated password.
 If the
 .Fl n
-flag is given, the password won't be persisted.
+flag is given the password won't be persisted and the
+.Ar entry
+argument is optional.
 .It Cm got Ar arguments
 Execute
 .Xr got 1