Package io.bdeploy.common.cli
Class ToolBase
java.lang.Object
io.bdeploy.common.cli.ToolBase
- Direct Known Subclasses:
BHiveCli
Main CLI entry point base class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBase class for all CLI tools.static classToolBase.ConfiguredCliTool<T extends Annotation>Base class for tools that accept additional configuration.static classBase class for tools which require access to the actual command line they have been passed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the tool instance for the given command line.static booleanReturns whether or not the test mode has been enabledstatic booleannamesOf(Class<? extends ToolBase.CliTool> tool) voidregister(Class<? extends ToolBase.CliTool> tool) voidsetAuditorFactory(Function<Path, Auditor> auditorFactory) Sets a factory for proper auditors to be used by the tool.static voidsetFailWithException(boolean fail) Indicates whether or not the tool should fail with an exception or should print out the errors to the command line.static voidsetTestMode(boolean test) Indicate that the tools are executed in the context of a JUNIT test.static voidsetTestModeForLLM(boolean test) void
-
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
- Throws:
Exception
-
getTool
Retrieve the tool instance for the given command line. The tool is already configured from command line arguments.- Throws:
Exception
-
namesOf
- 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
-
setAuditorFactory
Sets a factory for proper auditors to be used by the tool.
-