@Test void ignoreVersionAndHelpEnvVars() { beaconNodeCommand = new BeaconNodeCommand( outputWriter, errorWriter, Map.of("TEKU_VERSION", "1.2.3", "TEKU_HELP", "what?"), startAction); assertThat(beaconNodeCommand.parse(new String[0])).isZero(); }
public int parse(final String[] args) { final ConfigFileCommand configFileCommand = new ConfigFileCommand(); final CommandLine configFileCommandLine = getConfigFileCommandLine(configFileCommand); configFileCommandLine.parseArgs(args); if (configFileCommandLine.isUsageHelpRequested()) { return executeCommandUsageHelp(); } else if (configFileCommandLine.isVersionHelpRequested()) { return executeCommandVersion(); } final Optional<File> configFile = getConfigFileFromCliOrEnv(configFileCommand); final CommandLine commandLine = getCommandLine(); commandLine.setCaseInsensitiveEnumValuesAllowed(true); commandLine.setOut(outputWriter); commandLine.setErr(errorWriter); commandLine.setParameterExceptionHandler(this::handleParseException); commandLine.setDefaultValueProvider(defaultValueProvider(commandLine, configFile)); return commandLine.execute(args); }
BeaconNodeCommand implements Callable<Integer> { public int parse(final String[] args) { final ConfigFileCommand configFileCommand = new ConfigFileCommand(); final CommandLine configFileCommandLine = getConfigFileCommandLine(configFileCommand); configFileCommandLine.parseArgs(args); if (configFileCommandLine.isUsageHelpRequested()) { return executeCommandUsageHelp(); } else if (configFileCommandLine.isVersionHelpRequested()) { return executeCommandVersion(); } final Optional<File> configFile = getConfigFileFromCliOrEnv(configFileCommand); final CommandLine commandLine = getCommandLine(); commandLine.setCaseInsensitiveEnumValuesAllowed(true); commandLine.setOut(outputWriter); commandLine.setErr(errorWriter); commandLine.setParameterExceptionHandler(this::handleParseException); commandLine.setDefaultValueProvider(defaultValueProvider(commandLine, configFile)); return commandLine.execute(args); } }
BeaconNodeCommand implements Callable<Integer> { public int parse(final String[] args) { final ConfigFileCommand configFileCommand = new ConfigFileCommand(); final CommandLine configFileCommandLine = getConfigFileCommandLine(configFileCommand); configFileCommandLine.parseArgs(args); if (configFileCommandLine.isUsageHelpRequested()) { return executeCommandUsageHelp(); } else if (configFileCommandLine.isVersionHelpRequested()) { return executeCommandVersion(); } final Optional<File> configFile = getConfigFileFromCliOrEnv(configFileCommand); final CommandLine commandLine = getCommandLine(); commandLine.setCaseInsensitiveEnumValuesAllowed(true); commandLine.setOut(outputWriter); commandLine.setErr(errorWriter); commandLine.setParameterExceptionHandler(this::handleParseException); commandLine.setDefaultValueProvider(defaultValueProvider(commandLine, configFile)); return commandLine.execute(args); } BeaconNodeCommand(
      final PrintWriter outputWriter,
      final PrintWriter errorWriter,
      final Map<String, String> environment,
      final Consumer<TekuConfiguration> startAction); }
BeaconNodeCommand implements Callable<Integer> { public int parse(final String[] args) { final ConfigFileCommand configFileCommand = new ConfigFileCommand(); final CommandLine configFileCommandLine = getConfigFileCommandLine(configFileCommand); configFileCommandLine.parseArgs(args); if (configFileCommandLine.isUsageHelpRequested()) { return executeCommandUsageHelp(); } else if (configFileCommandLine.isVersionHelpRequested()) { return executeCommandVersion(); } final Optional<File> configFile = getConfigFileFromCliOrEnv(configFileCommand); final CommandLine commandLine = getCommandLine(); commandLine.setCaseInsensitiveEnumValuesAllowed(true); commandLine.setOut(outputWriter); commandLine.setErr(errorWriter); commandLine.setParameterExceptionHandler(this::handleParseException); commandLine.setDefaultValueProvider(defaultValueProvider(commandLine, configFile)); return commandLine.execute(args); } BeaconNodeCommand(
      final PrintWriter outputWriter,
      final PrintWriter errorWriter,
      final Map<String, String> environment,
      final Consumer<TekuConfiguration> startAction); int parse(final String[] args); @Override Integer call(); void reportUnexpectedError(final Throwable t); void reportUserError(final Throwable ex); void setLogLevels(); Level getLogLevel(); Consumer<TekuConfiguration> getStartAction(); }
BeaconNodeCommand implements Callable<Integer> { public int parse(final String[] args) { final ConfigFileCommand configFileCommand = new ConfigFileCommand(); final CommandLine configFileCommandLine = getConfigFileCommandLine(configFileCommand); configFileCommandLine.parseArgs(args); if (configFileCommandLine.isUsageHelpRequested()) { return executeCommandUsageHelp(); } else if (configFileCommandLine.isVersionHelpRequested()) { return executeCommandVersion(); } final Optional<File> configFile = getConfigFileFromCliOrEnv(configFileCommand); final CommandLine commandLine = getCommandLine(); commandLine.setCaseInsensitiveEnumValuesAllowed(true); commandLine.setOut(outputWriter); commandLine.setErr(errorWriter); commandLine.setParameterExceptionHandler(this::handleParseException); commandLine.setDefaultValueProvider(defaultValueProvider(commandLine, configFile)); return commandLine.execute(args); } BeaconNodeCommand(
      final PrintWriter outputWriter,
      final PrintWriter errorWriter,
      final Map<String, String> environment,
      final Consumer<TekuConfiguration> startAction); int parse(final String[] args); @Override Integer call(); void reportUnexpectedError(final Throwable t); void reportUserError(final Throwable ex); void setLogLevels(); Level getLogLevel(); Consumer<TekuConfiguration> getStartAction(); static final String CONFIG_FILE_OPTION_NAME; }