All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sop.cli.picocli.commands.ArmorCmd.kt Maven / Gradle / Ivy

There is a newer version: 10.0.3
Show newest version
// SPDX-FileCopyrightText: 2023 Paul Schaub 
//
// SPDX-License-Identifier: Apache-2.0

package sop.cli.picocli.commands

import java.io.IOException
import picocli.CommandLine.Command
import sop.cli.picocli.SopCLI
import sop.exception.SOPGPException.BadData
import sop.exception.SOPGPException.UnsupportedOption

@Command(
    name = "armor",
    resourceBundle = "msg_armor",
    exitCodeOnInvalidInput = UnsupportedOption.EXIT_CODE)
class ArmorCmd : AbstractSopCmd() {

    override fun run() {
        val armor = throwIfUnsupportedSubcommand(SopCLI.getSop().armor(), "armor")

        try {
            val ready = armor.data(System.`in`)
            ready.writeTo(System.out)
        } catch (badData: BadData) {
            val errorMsg = getMsg("sop.error.input.stdin_not_openpgp_data")
            throw BadData(errorMsg, badData)
        } catch (e: IOException) {
            throw RuntimeException(e)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy