diff --git a/java/src/org/openqa/selenium/grid/commands/CompletionCommand.java b/java/src/org/openqa/selenium/grid/commands/CompletionCommand.java index 208d0daf7317f..45d4306b543a7 100644 --- a/java/src/org/openqa/selenium/grid/commands/CompletionCommand.java +++ b/java/src/org/openqa/selenium/grid/commands/CompletionCommand.java @@ -54,7 +54,7 @@ public String getDescription() { @Override public Set getConfigurableRoles() { - return ALL_ROLES; + return Collections.singleton(Role.of("completion")); } @Override @@ -114,10 +114,10 @@ private void outputZshCompletions(PrintStream out) { Map> allCommands = listKnownCommands(); // My kingdom for multiline strings - out.println("#compdef selenium"); - out.println("local context state state_descr line"); + out.println("#compdef _selenium selenium"); out.println("typeset -A opt_args"); out.println("_selenium() {"); + out.println(" local context state state_descr line"); out.println(" _arguments -C \\"); out.println(" '(- :)--ext[Amend the classpath for Grid]: :->arg' \\"); out.println(" '(-): :->command' \\"); @@ -130,7 +130,7 @@ private void outputZshCompletions(PrintStream out) { allCommands.keySet().stream() .sorted(Comparator.comparing(CliCommand::getName)) .forEach(cmd -> { - out.println(String.format(" '%s:%s'", cmd.getName(), cmd.getDescription().replace("'", "\\'"))); + out.println(String.format(" '%s:%s'", cmd.getName(), cmd.getDescription().replace("'", "'\\''"))); }); out.println(" )"); @@ -161,7 +161,11 @@ private void outputZshCompletions(PrintStream out) { .filter(opt -> !opt.flags().isEmpty()) .sorted(Comparator.comparing(opt -> opt.flags().iterator().next())) .forEach(opt -> { - String quotedDesc = opt.description.replace("'", "\\''").replace(":", "\\:"); + String quotedDesc = opt.description().replace("'", "'\\''"); + int index = quotedDesc.indexOf("\n"); + if (index != -1) { + quotedDesc = quotedDesc.substring(0, index); + } if (opt.flags().size() == 1) { out.println(String.format(" '%s[%s]%s'", opt.flags().iterator().next(), quotedDesc, getZshType(opt))); @@ -181,8 +185,6 @@ private void outputZshCompletions(PrintStream out) { out.println(" _arguments $args && return"); out.println("}\n\n"); }); - - out.println("_selenium"); } private String getZshType(DescribedOption option) { diff --git a/java/src/org/openqa/selenium/grid/commands/InfoCommand.java b/java/src/org/openqa/selenium/grid/commands/InfoCommand.java index 62477c6eaaf77..887aff0214929 100644 --- a/java/src/org/openqa/selenium/grid/commands/InfoCommand.java +++ b/java/src/org/openqa/selenium/grid/commands/InfoCommand.java @@ -50,7 +50,7 @@ public String getDescription() { @Override public Set getConfigurableRoles() { - return Collections.emptySet(); + return Collections.singleton(Role.of("info")); } @Override diff --git a/java/src/org/openqa/selenium/grid/node/docker/DockerFlags.java b/java/src/org/openqa/selenium/grid/node/docker/DockerFlags.java index 4673bb6035be1..ca7a292aaa33f 100644 --- a/java/src/org/openqa/selenium/grid/node/docker/DockerFlags.java +++ b/java/src/org/openqa/selenium/grid/node/docker/DockerFlags.java @@ -60,7 +60,7 @@ public class DockerFlags implements HasRoles { @Parameter( names = {"--docker", "-D"}, description = "Docker configs which map image name to stereotype capabilities (example " + - "`-D selenium/standalone-firefox:latest '{\"browserName\": \"firefox\"}')", + "`-D selenium/standalone-firefox:latest '{\"browserName\": \"firefox\"}'`)", arity = 2, variableArity = true, splitter = NonSplittingSplitter.class)