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
FieldsModifier and TypeFieldDescriptionprotected booleanDetermines whether full stack traces should be displayed when exceptions occur. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CliConfigBuild aCliConfigto use.protected org.dellroad.jct.jshell.command.JShellCommandBuild aJShellCommandto use as the "jshell" command implementation.Get the prefix to use when displaying errors.static voidmain(BasicCliMain main, String[] args) Main entry point for a CLI application using the givenBasicCliMaininstance.static voidMain entry point for aBasicCliMainCLI application.intExecute 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
BasicCliMainreturns"Error". -
run
Execute the CLI application.- Parameters:
args- command line arguments- Returns:
- application exit value (0 = success, non-zero = error)
-
buildCliConfig
Build aCliConfigto use.The implementation in
BasicCliMainreturns 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 aJShellCommandto use as the "jshell" command implementation.The implementation in
BasicCliMainreturns 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 givenBasicCliMaininstance.This method never returns; instead, it invokes
System.exit(int)with an appropriate exit code.- Parameters:
main- CLI application
-
main
Main entry point for aBasicCliMainCLI application.
-