public interface Command
Launcher
class. Each command instance is created
by a CommandFactory
.
Command
implementation can retrieve argument and option using the Argument
and Option
annotations. Documentation / help is provided using the Summary
(single sentence) and
Description
annotations.
Commands follow a strict lifecycle. The setUp(ExecutionContext)
method is called with an
execution context. It lets you validate the inputs and prepare the environment is needed. The
run()
method is called immediately after setUp(ExecutionContext)
, and executes the
command. Finally, once the command has completed, the tearDown()
method is called. In this method
you have the opportunity to cleanup.
Modifier and Type | Method and Description |
---|---|
void |
run()
Executes the command.
|
void |
setUp(ExecutionContext context)
Set up the command execution environment.
|
void |
tearDown()
The command has been executed.
|
void setUp(ExecutionContext context) throws CLIException
context
- the contextCLIException
- if the validation failedvoid run() throws CLIException
CLIException
- If anything went wrong.void tearDown() throws CLIException
CLIException
- if anything went wrongCopyright © 2023 Eclipse. All rights reserved.