Package ai.wanaku.cli.main.commands
Class BaseCommand
java.lang.Object
ai.wanaku.cli.main.commands.BaseCommand
- Direct Known Subclasses:
Auth,AuthLogin,AuthLogout,AuthStatus,AuthToken,Capabilities,CapabilitiesBase,CapabilitiesCreate,CapabilitiesList,CapabilitiesShow,Completion,CompletionGenerate,DataStores,DataStoresAdd,DataStoresGet,DataStoresLabel,DataStoresLabelAdd,DataStoresLabelRemove,DataStoresList,DataStoresRemove,Forwards,ForwardsAdd,ForwardsList,ForwardsRemove,LabelExpressionMan,Man,NamespaceList,Namespaces,NamespacesLabel,NamespacesLabelAdd,NamespacesLabelRemove,Prompts,PromptsAdd,PromptsEdit,PromptsList,PromptsRemove,Resources,ResourcesExpose,ResourcesLabel,ResourcesLabelAdd,ResourcesLabelRemove,ResourcesList,ResourcesRemove,ResourcesShow,Start,StartBase,Tools,ToolsAdd,ToolsEdit,ToolSet,ToolSetAdd,ToolsGenerate,ToolsImport,ToolsLabel,ToolsLabelAdd,ToolsLabelRemove,ToolsList,ToolsRemove,ToolsShow
Abstract base class for all Wanaku CLI commands.
This class provides common functionality for all commands including:
- Terminal and printer initialization for consistent output formatting
- REST client initialization for communicating with the Wanaku service
- Standard exit codes for success and error conditions
- Help option handling
Subclasses must implement the doCall(Terminal, WanakuPrinter) method
to define their specific command behavior.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringstatic final intstatic final intprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncall()abstract IntegerdoCall(org.jline.terminal.Terminal terminal, WanakuPrinter printer) protected <T> TinitAuthenticatedService(Class<T> clazz, String host) protected static <T> TinitService(Class<T> clazz, String host) Initializes and configures the REST client for communicating with the Wanaku service.protected static <T> TinitService(Class<T> clazz, String host, String tokenOverride, boolean noAuth)
-
Field Details
-
EXIT_OK
public static final int EXIT_OK- See Also:
-
EXIT_ERROR
public static final int EXIT_ERROR- See Also:
-
authTokenOverride
-
noAuth
protected boolean noAuth
-
-
Constructor Details
-
BaseCommand
public BaseCommand()
-
-
Method Details
-
initService
Initializes and configures the REST client for communicating with the Wanaku service.Creates a properly configured Quarkus REST client builder with the specified host URL. The client is configured with appropriate timeouts and error handling for reliable communication with the Wanaku API endpoints.
- Type Parameters:
T- the type of the service interface- Parameters:
clazz- the Class object representing the service interfacehost- the base URL of the Wanaku service API (must be a valid URI)- Returns:
- a configured Service instance ready for API calls
- Throws:
IllegalArgumentException- if the host URL is invalid or malformedNullPointerException- if host is null
-
initAuthenticatedService
-
initService
-
call
-
doCall
public abstract Integer doCall(org.jline.terminal.Terminal terminal, WanakuPrinter printer) throws Exception - Throws:
Exception
-