public DefaultCommandLine addRawValue(Option option, String value) { if (!acceptMoreValues(option) && !option.isFlag()) { throw new CLIException("The option " + option.getName() + " does not accept value or has " + "already been set"); } if (! option.getChoices().isEmpty() && ! option.getChoices().contains(value)) { throw new InvalidValueException(option, value); } List<String> list = optionValues.get(option); if (list == null) { list = new ArrayList<>(); optionValues.put(option, list); } list.add(value); return this; }
protected void printGenericExecutionError(CLI cli, CLIException e) { getPrintStream().println("Error while executing command " + cli.getName() + ": " + e.getMessage() + getNewLine()); if (e.getCause() != null) { e.getCause().printStackTrace(getPrintStream()); } }
tty.write(e.getMessage() + "\n"); terminate(); return;
throw new CLIException("Cannot inject value for option '" + name + "'", e); throw new CLIException("Cannot inject value for argument '" + index + "'", e);
protected void printGenericExecutionError(CLI cli, CLIException e) { getPrintStream().println("Error while executing command " + cli.getName() + ": " + e.getMessage() + getNewLine()); if (e.getCause() != null) { e.getCause().printStackTrace(getPrintStream()); } }
for (Argument argument : cli.getArguments()) { if (usedIndexes.contains(argument.getIndex())) { throw new CLIException("Only one argument can use the index " + argument.getIndex()); throw new CLIException("Only the last argument can be multi-valued");
/** * Validates the command line parameters. * * @param context - the execution context * @throws CLIException - validation failed */ @Override public void setUp(ExecutionContext context) throws CLIException { super.setUp(context); CommandLine commandLine = executionContext.commandLine(); if (!isClustered() && ( commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-host")) || commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-port")) || commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-public-host")) || commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-public-port")) )) { throw new CLIException("The -cluster-xxx options require -cluster to be enabled"); } // If quorum and / or ha-group, ha need to have been explicitly set io.vertx.core.cli.Option haGroupOption = executionContext.cli().getOption("hagroup"); io.vertx.core.cli.Option quorumOption = executionContext.cli().getOption("quorum"); if (!ha && (commandLine.isOptionAssigned(haGroupOption) || commandLine.isOptionAssigned(quorumOption))) { throw new CLIException("The option -hagroup and -quorum requires -ha to be enabled"); } }
public DefaultCommandLine addRawValue(Option option, String value) { if (!acceptMoreValues(option) && !option.isFlag()) { throw new CLIException("The option " + option.getName() + " does not accept value or has " + "already been set"); } if (! option.getChoices().isEmpty() && ! option.getChoices().contains(value)) { throw new InvalidValueException(option, value); } List<String> list = optionValues.get(option); if (list == null) { list = new ArrayList<>(); optionValues.put(option, list); } list.add(value); return this; }
throw new CLIException("Cannot inject value for option '" + name + "'", e); throw new CLIException("Cannot inject value for argument '" + index + "'", e);
for (Argument argument : cli.getArguments()) { if (usedIndexes.contains(argument.getIndex())) { throw new CLIException("Only one argument can use the index " + argument.getIndex()); throw new CLIException("Only the last argument can be multi-valued");
/** * Validates the command line parameters. * * @param context - the execution context * @throws CLIException - validation failed */ @Override public void setUp(ExecutionContext context) throws CLIException { super.setUp(context); CommandLine commandLine = executionContext.commandLine(); if (!isClustered() && ( commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-host")) || commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-port")) || commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-public-host")) || commandLine.isOptionAssigned(executionContext.cli().getOption("cluster-public-port")) )) { throw new CLIException("The -cluster-xxx options require -cluster to be enabled"); } // If quorum and / or ha-group, ha need to have been explicitly set io.vertx.core.cli.Option haGroupOption = executionContext.cli().getOption("hagroup"); io.vertx.core.cli.Option quorumOption = executionContext.cli().getOption("quorum"); if (!ha && (commandLine.isOptionAssigned(haGroupOption) || commandLine.isOptionAssigned(quorumOption))) { throw new CLIException("The option -hagroup and -quorum requires -ha to be enabled"); } }
throw new CLIException(e.getMessage(), e); throw new CLIException(e.getMessage(), e);
throw new CLIException(e.getMessage(), e);
private void installGraalJS(Set<String> artifacts) throws CLIException { final File base = new File("node_modules"); File libs = new File(base, ".lib"); if (!libs.exists()) { if (!libs.mkdirs()) { throw new IllegalStateException("Failed to mkdirs 'node_modules/.lib'."); } } try { Resolver resolver = new Resolver(); for (Artifact a : resolver.resolve("org.graalvm.js:js:" + VERSIONS.getProperty("graalvm"), Arrays.asList("org.graalvm.tools:profiler:" + VERSIONS.getProperty("graalvm"), "org.graalvm.tools:chromeinspector:" + VERSIONS.getProperty("graalvm")))) { artifacts.add("../.lib/" + a.getFile().getName()); File destination = new File(libs, a.getFile().getName()); if (!destination.exists()) { Files.copy(a.getFile().toPath(), destination.toPath()); } } } catch (IOException e) { throw new CLIException(e.getMessage(), e); } }
private void installGraalJMVCICompiler() throws CLIException { final File base = new File("node_modules"); File libs = new File(base, ".jvmci"); if (!libs.exists()) { if (!libs.mkdirs()) { throw new IllegalStateException("Failed to mkdirs 'node_modules/.jvmci'."); } } try { Resolver resolver = new Resolver(); for (Artifact a : resolver.resolve("org.graalvm.compiler:compiler:" + VERSIONS.getProperty("graalvm"), Collections.emptyList())) { File destination = new File(libs, a.getArtifactId() + "." + a.getExtension()); if (!destination.exists()) { Files.copy(a.getFile().toPath(), destination.toPath()); } } } catch (IOException e) { throw new CLIException(e.getMessage(), e); } }
processModules(base, dependencies); } catch (IOException e) { throw new CLIException(e.getMessage(), e); throw new CLIException(e.getMessage(), e);
throw new CLIException(e.getMessage(), e);
message += "\n\t - " + descriptorFile.getAbsolutePath(); throw new CLIException(message);
message += "\n\t - " + descriptorFile.getAbsolutePath(); throw new CLIException(message);
message += "\n\t - " + descriptorFile.getAbsolutePath(); throw new CLIException(message);