Reference exit codes by Exception

This commit is contained in:
Paul Schaub 2023-07-12 14:22:57 +02:00
parent feb9efc733
commit edb384d157
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
11 changed files with 13 additions and 11 deletions

View file

@ -22,6 +22,7 @@ import sop.cli.picocli.commands.RevokeKeyCmd;
import sop.cli.picocli.commands.SignCmd; import sop.cli.picocli.commands.SignCmd;
import sop.cli.picocli.commands.VerifyCmd; import sop.cli.picocli.commands.VerifyCmd;
import sop.cli.picocli.commands.VersionCmd; import sop.cli.picocli.commands.VersionCmd;
import sop.exception.SOPGPException;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -30,7 +31,7 @@ import java.util.ResourceBundle;
@CommandLine.Command( @CommandLine.Command(
name = "sop", name = "sop",
resourceBundle = "msg_sop", resourceBundle = "msg_sop",
exitCodeOnInvalidInput = 69, exitCodeOnInvalidInput = SOPGPException.UnsupportedSubcommand.EXIT_CODE,
subcommands = { subcommands = {
// Meta Subcommands // Meta Subcommands
VersionCmd.class, VersionCmd.class,

View file

@ -18,7 +18,7 @@ import java.util.List;
@CommandLine.Command(name = "encrypt", @CommandLine.Command(name = "encrypt",
resourceBundle = "msg_encrypt", resourceBundle = "msg_encrypt",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class EncryptCmd extends AbstractSopCmd { public class EncryptCmd extends AbstractSopCmd {
@CommandLine.Option(names = "--no-armor", @CommandLine.Option(names = "--no-armor",

View file

@ -14,7 +14,7 @@ import sop.operation.ExtractCert;
@CommandLine.Command(name = "extract-cert", @CommandLine.Command(name = "extract-cert",
resourceBundle = "msg_extract-cert", resourceBundle = "msg_extract-cert",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class ExtractCertCmd extends AbstractSopCmd { public class ExtractCertCmd extends AbstractSopCmd {
@CommandLine.Option(names = "--no-armor", @CommandLine.Option(names = "--no-armor",

View file

@ -16,7 +16,7 @@ import java.util.List;
@CommandLine.Command(name = "generate-key", @CommandLine.Command(name = "generate-key",
resourceBundle = "msg_generate-key", resourceBundle = "msg_generate-key",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class GenerateKeyCmd extends AbstractSopCmd { public class GenerateKeyCmd extends AbstractSopCmd {
@CommandLine.Option(names = "--no-armor", @CommandLine.Option(names = "--no-armor",

View file

@ -18,7 +18,7 @@ import java.util.List;
@CommandLine.Command(name = "inline-sign", @CommandLine.Command(name = "inline-sign",
resourceBundle = "msg_inline-sign", resourceBundle = "msg_inline-sign",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class InlineSignCmd extends AbstractSopCmd { public class InlineSignCmd extends AbstractSopCmd {
@CommandLine.Option(names = "--no-armor", @CommandLine.Option(names = "--no-armor",

View file

@ -20,7 +20,7 @@ import java.util.List;
@CommandLine.Command(name = "inline-verify", @CommandLine.Command(name = "inline-verify",
resourceBundle = "msg_inline-verify", resourceBundle = "msg_inline-verify",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class InlineVerifyCmd extends AbstractSopCmd { public class InlineVerifyCmd extends AbstractSopCmd {
@CommandLine.Parameters(arity = "0..*", @CommandLine.Parameters(arity = "0..*",

View file

@ -13,7 +13,7 @@ import sop.operation.ListProfiles;
@CommandLine.Command(name = "list-profiles", @CommandLine.Command(name = "list-profiles",
resourceBundle = "msg_list-profiles", resourceBundle = "msg_list-profiles",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class ListProfilesCmd extends AbstractSopCmd { public class ListProfilesCmd extends AbstractSopCmd {
@CommandLine.Parameters(paramLabel = "COMMAND", arity = "1", descriptionKey = "subcommand") @CommandLine.Parameters(paramLabel = "COMMAND", arity = "1", descriptionKey = "subcommand")

View file

@ -14,7 +14,7 @@ import java.io.IOException;
@CommandLine.Command(name = "revoke-key", @CommandLine.Command(name = "revoke-key",
resourceBundle = "msg_revoke-key", resourceBundle = "msg_revoke-key",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class RevokeKeyCmd extends AbstractSopCmd { public class RevokeKeyCmd extends AbstractSopCmd {
@CommandLine.Option(names = "--no-armor", @CommandLine.Option(names = "--no-armor",

View file

@ -21,7 +21,7 @@ import java.util.List;
@CommandLine.Command(name = "sign", @CommandLine.Command(name = "sign",
resourceBundle = "msg_detached-sign", resourceBundle = "msg_detached-sign",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class SignCmd extends AbstractSopCmd { public class SignCmd extends AbstractSopCmd {
@CommandLine.Option(names = "--no-armor", @CommandLine.Option(names = "--no-armor",

View file

@ -18,7 +18,7 @@ import java.util.List;
@CommandLine.Command(name = "verify", @CommandLine.Command(name = "verify",
resourceBundle = "msg_detached-verify", resourceBundle = "msg_detached-verify",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class VerifyCmd extends AbstractSopCmd { public class VerifyCmd extends AbstractSopCmd {
@CommandLine.Parameters(index = "0", @CommandLine.Parameters(index = "0",

View file

@ -7,10 +7,11 @@ package sop.cli.picocli.commands;
import picocli.CommandLine; import picocli.CommandLine;
import sop.cli.picocli.Print; import sop.cli.picocli.Print;
import sop.cli.picocli.SopCLI; import sop.cli.picocli.SopCLI;
import sop.exception.SOPGPException;
import sop.operation.Version; import sop.operation.Version;
@CommandLine.Command(name = "version", resourceBundle = "msg_version", @CommandLine.Command(name = "version", resourceBundle = "msg_version",
exitCodeOnInvalidInput = 37) exitCodeOnInvalidInput = SOPGPException.UnsupportedOption.EXIT_CODE)
public class VersionCmd extends AbstractSopCmd { public class VersionCmd extends AbstractSopCmd {
@CommandLine.ArgGroup() @CommandLine.ArgGroup()