Package org.omegat.cli
Class SubCommands
java.lang.Object
org.omegat.cli.SubCommands
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsCommand(String key) Checks if a subcommand with the specified key exists in the registry.static Class<? extends BaseSubCommand>getCommand(String key) Gets the subcommand class associated with the specified key.Get all subcommand names.static voidregisterConsoleCommand(Class<? extends BaseSubCommand> subcommand) Registers a console command by deriving the command name from the specified subcommand class and associating it with the class in the subcommand registry.static voidregisterConsoleCommand(String name, Class<? extends BaseSubCommand> subcommand) Registers a console command by associating a command name with its corresponding subcommand class.
-
Method Details
-
registerConsoleCommand
Registers a console command by associating a command name with its corresponding subcommand class. This method adds the specified command to a collection of subcommands, enabling it to be later utilized or executed through the command-line interface.- Parameters:
name- the subcommand name of the console command to be registered.subcommand- the class representing the subcommand implementation associated with the given name.
-
registerConsoleCommand
Registers a console command by deriving the command name from the specified subcommand class and associating it with the class in the subcommand registry. The command name is automatically generated by removing the "Command" suffix from the class name and converting the result to lowercase.- Parameters:
subcommand- the class representing the subcommand implementation whose name is to be derived and registered in the subcommand registry.
-
containsCommand
Checks if a subcommand with the specified key exists in the registry.- Parameters:
key- the key to check for existence- Returns:
- true if the subcommand exists, false otherwise
-
getCommand
Gets the subcommand class associated with the specified key.- Parameters:
key- subcommand key- Returns:
- subcommand class
-
getSubcommandNames
Get all subcommand names.- Returns:
- set of subcommand names
-