java.lang.Object
org.elasticsearch.cli.Command
- All Implemented Interfaces:
- Closeable,- AutoCloseable
- Direct Known Subclasses:
- MultiCommand
An action to execute within a cli.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final StringA description of the command, used in the help output.protected final joptsimple.OptionParserThe option parser for this command.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()protected abstract voidexecute(Terminal terminal, joptsimple.OptionSet options, ProcessInfo processInfo) Executes this command.protected static voidexit(int status) final intmain(String[] args, Terminal terminal, ProcessInfo processInfo) Parses options for this command from args and executes it.protected voidmainWithoutErrorHandling(String[] args, Terminal terminal, ProcessInfo processInfo) Executes the command, but all errors are thrown.joptsimple.OptionSetparseOptions(String[] args) Parse command line arguments for this command.protected voidprintAdditionalHelp(Terminal terminal) Prints additional help information, specific to the commandprotected voidprintUserException(Terminal terminal, UserException e) 
- 
Field Details- 
descriptionA description of the command, used in the help output.
- 
parserprotected final joptsimple.OptionParser parserThe option parser for this command.
 
- 
- 
Constructor Details- 
CommandConstruct the command with the specified command description and runnable to execute before main is invoked.- Parameters:
- description- the command description
 
 
- 
- 
Method Details- 
mainParses options for this command from args and executes it.- Throws:
- Exception
 
- 
mainWithoutErrorHandlingprotected void mainWithoutErrorHandling(String[] args, Terminal terminal, ProcessInfo processInfo) throws Exception Executes the command, but all errors are thrown.- Throws:
- Exception
 
- 
parseOptionsParse command line arguments for this command.- Parameters:
- args- The string arguments passed to the command
- Returns:
- A set of parsed options
 
- 
printAdditionalHelpPrints additional help information, specific to the command
- 
printUserException
- 
exitprotected static void exit(int status) 
- 
executeprotected abstract void execute(Terminal terminal, joptsimple.OptionSet options, ProcessInfo processInfo) throws Exception Executes this command. Any runtime user errors (like an input file that does not exist), should throw aUserException.- Throws:
- Exception
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
-