@Command(name = "version", description = "Show the Graylog and JVM versions") public class ShowVersion implements CliCommand { private final Version version = Version.CURRENT_CLASSPATH; @Override public void run() { System.out.println("Graylog " + version); System.out.println("JRE: " + Tools.getSystemInformation()); } }
@Command(name = "truncate", description = "Truncates the journal to a given offset") public class JournalTruncate extends AbstractJournalCommand { @Option(name = {"-o", "--offset"}, description = "Truncate journal up to this offset, no remaining offset will be larger than the given offset.") @Required private long offset = Long.MIN_VALUE; public JournalTruncate() { super("truncate-journal"); } @Override protected void runCommand() { try { final long logEndOffset = journal.getLogEndOffset(); if (offset > logEndOffset) { System.err.println("Truncating journal to " + offset + " has no effect as the largest offset in the log is " + (logEndOffset - 1) + "."); } else { journal.truncateTo(offset); } } catch (IllegalArgumentException e) { System.err.println("Illegal offset value " + offset); } } }
@SuppressWarnings("LocalCanBeFinal") @Command(name = "show", description = "Shows information about the persisted message journal") public class JournalShow extends AbstractJournalCommand { @Option(name = {"-s", "--show-segments"}, description = "Show detail information for all segments") private boolean showSegmentDetails = false;
@Command(name = "server", description = "KSQL Cluster") public class ServerOptions { public HelpOption help; @Once @Required @Arguments( title = "config-file", description = "A file specifying configs for the KSQL Server, KSQL, " private String propertiesFile; @Option( name = "--queries-file", description = "Path to the query file on the local machine.")
@Groups({ @Group(name = "groupInsideOfGroups subGroup", description = "my nested sub-group", defaultCommand = CommandWithSubGroupsAnnotation.class,commands = {CommandAdd.class}), @Group(name = "groupInsideOfGroups", description = "top level group", commands = { CommandWithSubGroupsAnnotation.class }) }) @Command(name = "commandWithSubGroupsAnno", description = "A command with a groups annotation defining a sub-group") public class CommandWithSubGroupsAnnotation extends AbstractGroupAnnotationCommand { @Option(name = "-v", type = OptionType.GROUP) public boolean verbose = false; }
@Command(name = "decode", description = "Decodes messages from the journal") public class JournalDecode extends AbstractJournalCommand { @Arguments(description = "Range of message offsets to decode, e.g. single number 1234567, upper bound ..123456, lower bound 123456..., both 123456..123458") @Required private String rangeArg;
protected CmdLineTool(String commandName, BaseConfiguration configuration) { jadConfig = new JadConfig(); jadConfig.addConverterFactory(new GuavaConverterFactory()); jadConfig.addConverterFactory(new JodaTimeConverterFactory()); if (commandName == null) { if (this.getClass().isAnnotationPresent(Command.class)) { this.commandName = this.getClass().getAnnotation(Command.class).name(); } else { this.commandName = "tool"; } } else { this.commandName = commandName; } this.configuration = configuration; this.chainingClassLoader = new ChainingClassLoader(this.getClass().getClassLoader()); }
@Command(name = "ksql", description = "KSQL CLI") public class Options { @Once @Required @Arguments( title = "server", description = "The address of the Ksql server to connect to (ex: http://confluent.io:9098)") @Option( name = CONFIGURATION_FILE_OPTION_NAME, description = "A file specifying configs for Ksql and its underlying Kafka Streams " @Option( name = {USERNAME_OPTION, USERNAME_SHORT_OPTION}, description = @Option( name = {PASSWORD_OPTION, PASSWORD_SHORT_OPTION}, description = @Option( name = STREAMED_QUERY_ROW_LIMIT_OPTION_NAME, description = "An optional maximum number of rows to read from streamed queries") @LongRange( min = 1) private Long streamedQueryRowLimit; @Option(
@Command(name = "server", description = "Start the Graylog server") public class Server extends ServerBootstrap { private static final Logger LOG = LoggerFactory.getLogger(Server.class); @Option(name = {"-l", "--local"}, description = "Run Graylog in local mode. Only interesting for Graylog developers.") private boolean local = false;
@Groups({ @Group(name = "groupInsideOfGroups", description = "my nested group", defaultCommand = CommandWithGroupsAnnotation.class,commands = {CommandAdd.class}) }) @Command(name = "commandWithGroupsAnno", description = "A command with a groups annotation") public class CommandWithGroupsAnnotation extends AbstractGroupAnnotationCommand { @Option(name = "-v", type = OptionType.GROUP) public boolean verbose = false; }
protected final ChainingClassLoader chainingClassLoader; @Option(name = "--dump-config", description = "Show the effective Graylog configuration and exit") protected boolean dumpConfig = false; @Option(name = "--dump-default-config", description = "Show the default configuration and exit") protected boolean dumpDefaultConfig = false; @Option(name = {"-d", "--debug"}, description = "Run Graylog in debug mode") private boolean debug = false; @Option(name = {"-f", "--configfile"}, description = "Configuration file for Graylog") private String configFile = "/etc/graylog/server/server.conf";
@Command(name = "add", description = "Adds a remote") public static class RemoteAdd extends GitCommand { @Option(name = "-t", description = "Track only a specific branch") public String branch; @Arguments(description = "Name and URL of remote repository to add", title={"name", "url"}) public List<String> remote; } }
@Command(name = "ArgsMergeOverride") public class ArgsMergeOverride extends ArgsMergeAddition { /** * This is a legal option override because we explicitly stated that override is true */ @Option(name = "--hidden", description = "A now visible option", override = true) public boolean hidden = false; }
@Command(name = "add", description = "Add file contents to the index") public static class Add extends GitCommand { @Arguments(description = "Patterns of files to be added") public List<String> patterns; @Option(name = "-i", description = "Add modified contents interactively.") public boolean interactive; }
@Command(name = "OptionParsing1") public static class OptionParsing { @Option(name = { "-a", "--alpha" }) private boolean alpha; @Option(name = { "-b", "--beta" }, arity = 1) private String beta; @Option(name = { "-c", "--charlie" }, arity = 2) private List<String> charlie = new ArrayList<String>(); }