mirror of
https://codeberg.org/PGPainless/sop-java.git
synced 2025-09-08 17:59:43 +02:00
Implement sop encrypt --profile=XXX
This commit is contained in:
parent
f4ff5f89f7
commit
8a66f0bc4f
3 changed files with 38 additions and 0 deletions
|
@ -41,6 +41,10 @@ public class EncryptCmd extends AbstractSopCmd {
|
|||
paramLabel = "PASSWORD")
|
||||
List<String> withKeyPassword = new ArrayList<>();
|
||||
|
||||
@CommandLine.Option(names = "--profile",
|
||||
paramLabel = "PROFILE")
|
||||
String profile;
|
||||
|
||||
@CommandLine.Parameters(index = "0..*",
|
||||
paramLabel = "CERTS")
|
||||
List<String> certs = new ArrayList<>();
|
||||
|
@ -50,6 +54,15 @@ public class EncryptCmd extends AbstractSopCmd {
|
|||
Encrypt encrypt = throwIfUnsupportedSubcommand(
|
||||
SopCLI.getSop().encrypt(), "encrypt");
|
||||
|
||||
if (profile != null) {
|
||||
try {
|
||||
encrypt.profile(profile);
|
||||
} catch (SOPGPException.UnsupportedProfile e) {
|
||||
String errorMsg = getMsg("sop.error.usage.profile_not_supported", "encrypt", profile);
|
||||
throw new SOPGPException.UnsupportedProfile(errorMsg, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (type != null) {
|
||||
try {
|
||||
encrypt.mode(type);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue