Package io.permazen.cli.main
Class BasicCliMain
java.lang.Object
io.permazen.cli.main.BasicCliMain
- Direct Known Subclasses:
CliMain
A "main" class for Permazen CLI applications.
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Determines whether full stack traces should be displayed when exceptions occur. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected CliConfig
Build aCliConfig
to use.protected org.dellroad.jct.jshell.command.JShellCommand
Build aJShellCommand
to use as the "jshell" command implementation.Get the prefix to use when displaying errors.static void
main
(BasicCliMain main, String[] args) Main entry point for a CLI application using the givenBasicCliMain
instance.static void
Main entry point for aBasicCliMain
CLI application.int
Execute the CLI application.
-
Field Details
-
showErrorStackTraces
protected boolean showErrorStackTracesDetermines whether full stack traces should be displayed when exceptions occur.
-
-
Constructor Details
-
BasicCliMain
public BasicCliMain()
-
-
Method Details
-
getErrorPrefix
Get the prefix to use when displaying errors.The implementation in
BasicCliMain
returns"Error"
. -
run
Execute the CLI application.- Parameters:
args
- command line arguments- Returns:
- application exit value (0 = success, non-zero = error)
-
buildCliConfig
Build aCliConfig
to use.The implementation in
BasicCliMain
returns a newPermazenCliConfig
. Subclasses can override this method to restrict to lower layers (e.g., Core API), add additional command-line flags, etc.- Returns:
- CLI configuration
-
buildJShellCommand
protected org.dellroad.jct.jshell.command.JShellCommand buildJShellCommand()Build aJShellCommand
to use as the "jshell" command implementation.The implementation in
BasicCliMain
returns a newPermazenJShellCommand
. Subclasses can override this method to add additional configuration, startup scripts, etc.- Returns:
- "jshell" command, or null for the default
-
main
Main entry point for a CLI application using the givenBasicCliMain
instance.This method never returns; instead, it invokes
System.exit(int)
with an appropriate exit code.- Parameters:
main
- CLI application
-
main
Main entry point for aBasicCliMain
CLI application.
-