Class NlsMain

    • Constructor Detail

      • NlsMain

        public NlsMain()
        The constructor.
      • NlsMain

        public NlsMain​(CliConsole console)
        The constructor.
        Parameters:
        console - the console.
    • Method Detail

      • add

        protected void add​(CliCommand command)
        Parameters:
        command - the CliCommand to register.
      • isTolerateDuplicateOptions

        protected boolean isTolerateDuplicateOptions()
        Typically a program shall provide multiple values for a CliOption by providing them as multiple CliValues after the CliOption (e.g. "--keys foo bar some"). However, some programs like to repeat the same CliOption 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 same CliOption, false otherwise (default).
      • run

        public final int run​(CliArgs args)
        Description copied from class: CliMain
        Has to be implemented to handle that given CliArgs and do the program logic.
        Specified by:
        run in class CliMain
        Parameters:
        args - the CliArgs.
        Returns:
        the exit code.
      • isPrintHelpPerCommand

        protected boolean isPrintHelpPerCommand()
        Returns:
        true if the help shall be printed per CliCommand with all its arguments (options and parameters), false otherwise (to first print all CliCommands 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.