mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2024-11-22 15:12:06 +01:00
GenerateKeyCmd: Do not assert default profile
This commit is contained in:
parent
19663c4dec
commit
d38556f79a
1 changed files with 10 additions and 8 deletions
|
@ -32,13 +32,22 @@ public class GenerateKeyCmd extends AbstractSopCmd {
|
||||||
|
|
||||||
@CommandLine.Option(names = "--profile",
|
@CommandLine.Option(names = "--profile",
|
||||||
paramLabel = "PROFILE")
|
paramLabel = "PROFILE")
|
||||||
String profile = "default";
|
String profile;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
GenerateKey generateKey = throwIfUnsupportedSubcommand(
|
GenerateKey generateKey = throwIfUnsupportedSubcommand(
|
||||||
SopCLI.getSop().generateKey(), "generate-key");
|
SopCLI.getSop().generateKey(), "generate-key");
|
||||||
|
|
||||||
|
if (profile != null) {
|
||||||
|
try {
|
||||||
|
generateKey.profile(profile);
|
||||||
|
} catch (SOPGPException.UnsupportedProfile e) {
|
||||||
|
String errorMsg = getMsg("sop.error.usage.profile_not_supported", "generate-key", profile);
|
||||||
|
throw new SOPGPException.UnsupportedProfile(errorMsg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (String userId : userId) {
|
for (String userId : userId) {
|
||||||
generateKey.userId(userId);
|
generateKey.userId(userId);
|
||||||
}
|
}
|
||||||
|
@ -47,13 +56,6 @@ public class GenerateKeyCmd extends AbstractSopCmd {
|
||||||
generateKey.noArmor();
|
generateKey.noArmor();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
generateKey.profile(profile);
|
|
||||||
} catch (SOPGPException.UnsupportedProfile e) {
|
|
||||||
String errorMsg = getMsg("sop.error.usage.profile_not_supported", "generate-key", profile);
|
|
||||||
throw new SOPGPException.UnsupportedProfile(errorMsg, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (withKeyPassword != null) {
|
if (withKeyPassword != null) {
|
||||||
try {
|
try {
|
||||||
String password = stringFromInputStream(getInput(withKeyPassword));
|
String password = stringFromInputStream(getInput(withKeyPassword));
|
||||||
|
|
Loading…
Reference in a new issue