Package morfologik.tools
Class CliTool
- java.lang.Object
-
- morfologik.tools.CliTool
-
- All Implemented Interfaces:
java.util.concurrent.Callable<ExitStatus>
- Direct Known Subclasses:
DictApply
,DictCompile
,DictDecompile
,FSACompile
,FSADecompile
,FSAInfo
public abstract class CliTool extends java.lang.Object implements java.util.concurrent.Callable<ExitStatus>
Base class for command-line applications.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
ARG_OVERWRITE
protected static java.lang.String
ARG_VALIDATE
private boolean
callSystemExit
private boolean
help
-
Constructor Summary
Constructors Constructor Description CliTool()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static <T> T
checkNotNull(T arg)
private static void
helpDisplayCommandOptions(java.io.PrintStream pw, com.beust.jcommander.JCommander jc)
private static void
helpDisplayCommandOptions(java.io.PrintStream pw, java.lang.String command, com.beust.jcommander.JCommander jc)
protected static void
main(java.lang.String[] args, CliTool command)
Parse and execute a single command.protected static void
main(java.lang.String[] args, CliTool... commands)
Parse and execute one of the commands.protected static void
printf(java.lang.String msg, java.lang.Object... args)
void
setCallSystemExit(boolean flag)
CallSystem.exit(int)
at the end of command processing.
-
-
-
Field Detail
-
ARG_OVERWRITE
protected static final java.lang.String ARG_OVERWRITE
- See Also:
- Constant Field Values
-
ARG_VALIDATE
protected static final java.lang.String ARG_VALIDATE
- See Also:
- Constant Field Values
-
callSystemExit
private boolean callSystemExit
-
help
private boolean help
-
-
Method Detail
-
setCallSystemExit
public void setCallSystemExit(boolean flag)
CallSystem.exit(int)
at the end of command processing.- Parameters:
flag
- CallSystem.exit(int)
iftrue
.
-
main
protected static void main(java.lang.String[] args, CliTool... commands)
Parse and execute one of the commands.- Parameters:
args
- Command line arguments (command and options).commands
- A list of commands.
-
main
protected static void main(java.lang.String[] args, CliTool command)
Parse and execute a single command.- Parameters:
args
- Command line arguments (command and options).command
- The command to execute.
-
printf
protected static void printf(java.lang.String msg, java.lang.Object... args)
-
checkNotNull
protected static <T> T checkNotNull(T arg)
-
helpDisplayCommandOptions
private static void helpDisplayCommandOptions(java.io.PrintStream pw, java.lang.String command, com.beust.jcommander.JCommander jc)
-
helpDisplayCommandOptions
private static void helpDisplayCommandOptions(java.io.PrintStream pw, com.beust.jcommander.JCommander jc)
-
-