|
32 | 32 | import java.util.concurrent.Callable; |
33 | 33 | import org.apache.logging.converter.config.ConfigurationConverter; |
34 | 34 | import org.jspecify.annotations.Nullable; |
| 35 | +import picocli.CommandLine; |
35 | 36 | import picocli.CommandLine.Command; |
36 | 37 | import picocli.CommandLine.Option; |
37 | 38 | import picocli.CommandLine.Parameters; |
38 | 39 |
|
39 | 40 | @Command( |
40 | | - name = "configFile", |
| 41 | + name = "config-file", |
41 | 42 | description = "Handles the transformation of logging configuration files.", |
42 | | - subcommands = {ConfigurationFileCommands.Convert.class, ConfigurationFileCommands.ListFormats.class}) |
43 | | -class ConfigurationFileCommands { |
| 43 | + mixinStandardHelpOptions = true, |
| 44 | + subcommands = {ConfigurationFileCommands.Convert.class, ConfigurationFileCommands.ListFormats.class}, |
| 45 | + versionProvider = Main.VersionProvider.class) |
| 46 | +public final class ConfigurationFileCommands { |
44 | 47 |
|
45 | 48 | private static final int PADDING_SIZE = 2; |
46 | 49 |
|
47 | | - @Command(name = "listFormats", description = "Lists the supported configuration file formats.") |
| 50 | + public static void main(final String[] args) { |
| 51 | + System.exit(new CommandLine(ConfigurationFileCommands.class).execute(args)); |
| 52 | + } |
| 53 | + |
| 54 | + private ConfigurationFileCommands() {} |
| 55 | + |
| 56 | + @Command( |
| 57 | + name = "list-formats", |
| 58 | + description = "Lists the supported configuration file formats.", |
| 59 | + mixinStandardHelpOptions = true, |
| 60 | + versionProvider = Main.VersionProvider.class) |
48 | 61 | static class ListFormats implements Callable<Integer> { |
49 | 62 |
|
50 | 63 | private final ConfigurationConverter converter = ConfigurationConverter.getInstance(); |
@@ -100,7 +113,11 @@ private static List<? extends CharSequence> formatRows(Collection<SupportedForma |
100 | 113 | } |
101 | 114 | } |
102 | 115 |
|
103 | | - @Command(name = "convert", description = "Converts a logging configuration file to a different format.") |
| 116 | + @Command( |
| 117 | + name = "convert", |
| 118 | + description = "Converts a logging configuration file to a different format.", |
| 119 | + mixinStandardHelpOptions = true, |
| 120 | + versionProvider = Main.VersionProvider.class) |
104 | 121 | static class Convert implements Callable<Integer> { |
105 | 122 |
|
106 | 123 | private final ConfigurationConverter converter = ConfigurationConverter.getInstance(); |
|
0 commit comments