- 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 voidadd(CliCommand command)protected StringgetProgramName()protected booleanisPrintHelpPerCommand()protected booleanisTolerateDuplicateOptions()protected voidprintHelp()Prints the help usage of this program.intrun(CliArgs args)Has to be implemented to handle that givenCliArgsand 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- theCliCommandto register.
-
isTolerateDuplicateOptions
protected boolean isTolerateDuplicateOptions()
Typically a program shall provide multiple values for aCliOptionby providing them as multipleCliValues after theCliOption(e.g. "--keys foo bar some"). However, some programs like to repeat the sameCliOptionfor 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:
trueto tolerate duplicate occurrences of the sameCliOption,falseotherwise (default).
-
run
public final int run(CliArgs args)
Description copied from class:CliMainHas to be implemented to handle that givenCliArgsand do the program logic.
-
isPrintHelpPerCommand
protected boolean isPrintHelpPerCommand()
- Returns:
trueif the help shall be printed perCliCommandwith all its arguments (options and parameters),falseotherwise (to first print allCliCommands 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.
-
-