diff --git a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/GenerateKeyCmd.java b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/GenerateKeyCmd.java index 1d08b7c..aac7124 100644 --- a/sop-java-picocli/src/main/java/sop/cli/picocli/commands/GenerateKeyCmd.java +++ b/sop-java-picocli/src/main/java/sop/cli/picocli/commands/GenerateKeyCmd.java @@ -32,13 +32,22 @@ public class GenerateKeyCmd extends AbstractSopCmd { @CommandLine.Option(names = "--profile", paramLabel = "PROFILE") - String profile = "default"; + String profile; @Override public void run() { GenerateKey generateKey = throwIfUnsupportedSubcommand( 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) { generateKey.userId(userId); } @@ -47,13 +56,6 @@ public class GenerateKeyCmd extends AbstractSopCmd { 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) { try { String password = stringFromInputStream(getInput(withKeyPassword));