Class SubCommands

java.lang.Object
org.omegat.cli.SubCommands

public final class SubCommands extends Object
  • Method Details

    • registerConsoleCommand

      public static void registerConsoleCommand(String name, Class<? extends BaseSubCommand> subcommand)
      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

      public static void registerConsoleCommand(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. 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

      public static boolean containsCommand(String key)
      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

      public static Class<? extends BaseSubCommand> getCommand(String key)
      Gets the subcommand class associated with the specified key.
      Parameters:
      key - subcommand key
      Returns:
      subcommand class
    • getSubcommandNames

      public static Set<String> getSubcommandNames()
      Get all subcommand names.
      Returns:
      set of subcommand names