- java.lang.Object
-
- io.github.mmm.cli.CliMain
-
- io.github.mmm.nls.cli.NlsMain
-
- Direct Known Subclasses:
NlsSynchronizer
public abstract class NlsMain extends CliMain
Main program
(CLI) .
-
-
Constructor Summary
Constructors Constructor Description NlsMain()
The constructor.NlsMain(CliConsole console)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
add(CliCommand command)
protected String
getProgramName()
protected boolean
isPrintHelpPerCommand()
protected boolean
isTolerateDuplicateOptions()
protected void
printHelp()
Prints the help usage of this program.int
run(CliArgs args)
Has to be implemented to handle that givenCliArgs
and do the program logic.-
Methods inherited from class io.github.mmm.cli.CliMain
console, error, error, getVersion, run, runAndExit
-
-
-
-
Constructor Detail
-
NlsMain
public NlsMain()
The constructor.
-
NlsMain
public NlsMain(CliConsole console)
The constructor.- Parameters:
console
- theconsole
.
-
-
Method Detail
-
add
protected void add(CliCommand command)
- Parameters:
command
- theCliCommand
to register.
-
isTolerateDuplicateOptions
protected boolean isTolerateDuplicateOptions()
Typically a program shall provide multiple values for aCliOption
by providing them as multipleCliValue
s after theCliOption
(e.g. "--keys foo bar some"). However, some programs like to repeat the sameCliOption
for that purpose (e.g. "--key foo --key bar --key some"). By default this will cause an error as it is not recommended. However, if you want to support this in your CLI program, you may override this method.- Returns:
true
to tolerate duplicate occurrences of the sameCliOption
,false
otherwise (default).
-
run
public final int run(CliArgs args)
Description copied from class:CliMain
Has to be implemented to handle that givenCliArgs
and do the program logic.
-
isPrintHelpPerCommand
protected boolean isPrintHelpPerCommand()
- Returns:
true
if the help shall be printed perCliCommand
with all its arguments (options and parameters),false
otherwise (to first print allCliCommand
s and then print all arguments together).
-
getProgramName
protected String getProgramName()
- Returns:
- the name of this program.
-
printHelp
protected void printHelp()
Prints the help usage of this program.
-
-