ArmorCMD: Drop --label option

This commit is contained in:
Paul Schaub 2023-11-15 15:24:09 +01:00
parent 03cabdf3fb
commit 802bc0aa73
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -6,9 +6,7 @@ package sop.cli.picocli.commands
import java.io.IOException import java.io.IOException
import picocli.CommandLine.Command import picocli.CommandLine.Command
import picocli.CommandLine.Option
import sop.cli.picocli.SopCLI import sop.cli.picocli.SopCLI
import sop.enums.ArmorLabel
import sop.exception.SOPGPException.BadData import sop.exception.SOPGPException.BadData
import sop.exception.SOPGPException.UnsupportedOption import sop.exception.SOPGPException.UnsupportedOption
@ -18,21 +16,9 @@ import sop.exception.SOPGPException.UnsupportedOption
exitCodeOnInvalidInput = UnsupportedOption.EXIT_CODE) exitCodeOnInvalidInput = UnsupportedOption.EXIT_CODE)
class ArmorCmd : AbstractSopCmd() { class ArmorCmd : AbstractSopCmd() {
@Option(names = ["--label"], paramLabel = "{auto|sig|key|cert|message}")
var label: ArmorLabel? = null
override fun run() { override fun run() {
val armor = throwIfUnsupportedSubcommand(SopCLI.getSop().armor(), "armor") val armor = throwIfUnsupportedSubcommand(SopCLI.getSop().armor(), "armor")
label?.let {
try {
armor.label(it)
} catch (unsupported: UnsupportedOption) {
val errorMsg = getMsg("sop.error.feature_support.option_not_supported", "--label")
throw UnsupportedOption(errorMsg, unsupported)
}
}
try { try {
val ready = armor.data(System.`in`) val ready = armor.data(System.`in`)
ready.writeTo(System.out) ready.writeTo(System.out)