Class ToolBase

java.lang.Object
io.bdeploy.common.cli.ToolBase
Direct Known Subclasses:
BHiveCli

public abstract class ToolBase extends Object
Main CLI entry point base class.
  • Constructor Details

    • ToolBase

      public ToolBase()
  • Method Details

    • setTestMode

      public static void setTestMode(boolean test)
      Indicate that the tools are executed in the context of a JUNIT test. In this mode the tools will NOT take values from the environmental as fallback for command line arguments. Only arguments directly passed to the tool are evaluated. Additionally the tools will fail with an exception without exiting the JVM.
    • setTestModeForLLM

      public static void setTestModeForLLM(boolean test)
    • setFailWithException

      public static void setFailWithException(boolean fail)
      Indicates whether or not the tool should fail with an exception or should print out the errors to the command line.
    • isTestMode

      public static boolean isTestMode()
      Returns whether or not the test mode has been enabled
    • isTestModeLLM

      public static boolean isTestModeLLM()
    • toolMain

      public void toolMain(String... args) throws Exception
      Throws:
      Exception
    • getTool

      public ToolBase.CliTool getTool(String... args) throws Exception
      Retrieve the tool instance for the given command line. The tool is already configured from command line arguments.
      Throws:
      Exception
    • namesOf

      public static List<String> namesOf(Class<? extends ToolBase.CliTool> tool)
      Parameters:
      tool - the tool to inspect
      Returns:
      all the names the tool should be known under. The 'official' name is the first in the list, the rest are aliases.
    • register

      public void register(Class<? extends ToolBase.CliTool> tool)
    • setAuditorFactory

      public void setAuditorFactory(Function<Path,Auditor> auditorFactory)
      Sets a factory for proper auditors to be used by the tool.