Java Code Examples for io.airlift.airline.Help#help()
The following examples show how to use
io.airlift.airline.Help#help() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestingPrestoServerLauncher.java From presto with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { TestingPrestoServerLauncher launcher = singleCommand(TestingPrestoServerLauncher.class).parse(args); if (launcher.helpOption.showHelpIfRequested()) { return; } try { launcher.validateOptions(); } catch (IllegalStateException e) { System.out.println("ERROR: " + e.getMessage()); System.out.println(); Help.help(launcher.commandMetadata); return; } launcher.run(); }
Example 2
Source File: Configurable.java From activemq-artemis with Apache License 2.0 | 5 votes |
protected void helpGroup(String groupName, String commandName) { for (CommandGroupMetadata group : global.getCommandGroups()) { if (group.getName().equals(groupName)) { for (CommandMetadata command : group.getCommands()) { if (command.getName().equals(commandName)) { Help.help(command); } } break; } } }
Example 3
Source File: PluginAddCommand.java From gyro with Apache License 2.0 | 4 votes |
@Override protected void executeSubCommand() throws Exception { if (getPlugins().isEmpty()) { Help.help(MetadataLoader.loadCommand(PluginAddCommand.class)); return; } GyroCore.ui().write("\n"); Set<String> installedPlugins = getPlugins() .stream() .filter(f -> !pluginNotExist(f)) .collect(Collectors.toSet()); installedPlugins.stream() .map(p -> String.format("@|bold %s|@ is already installed.%n", p)) .forEach(GyroCore.ui()::write); Set<String> plugins = getPlugins() .stream() .filter(this::pluginNotExist) .collect(Collectors.toSet()); if (plugins.isEmpty()) { return; } if (repositories == null) { repositories = new ArrayList<>(); repositories.add(RepositorySettings.CENTRAL); } getRepositoryNodes() .stream() .map(this::toRepositoryUrl) .forEach(s -> repositories.add(new RemoteRepository.Builder(s, "default", s).build())); plugins = plugins .stream() .filter(this::validate) .collect(Collectors.toSet()); StringBuilder sb = new StringBuilder(); load() .stream() .map(l -> l + "\n") .forEach(sb::append); plugins.forEach(p -> sb.append(String.format("%s '%s'%n", "@plugin:", p))); save(sb.toString()); plugins.stream() .map(p -> String.format("@|bold %s|@ has been added.%n", p)) .forEach(GyroCore.ui()::write); }
Example 4
Source File: PluginRemoveCommand.java From gyro with Apache License 2.0 | 4 votes |
@Override protected void executeSubCommand() throws Exception { if (getPlugins().isEmpty()) { Help.help(MetadataLoader.loadCommand(PluginRemoveCommand.class)); return; } List<DirectiveNode> removeNodes = getPluginNodes() .stream() .filter(this::pluginNodeExist) .collect(Collectors.toList()); List<DirectiveNode> invalidNodes = getPluginNodes() .stream() .filter(f -> !pluginNodeExist(f)) .collect(Collectors.toList()); StringBuilder sb = new StringBuilder(); int lineNumber = 0; for (String line : load()) { boolean skipLine = false; for (DirectiveNode pluginNode : removeNodes) { if (lineNumber >= pluginNode.getStartLine() && lineNumber <= pluginNode.getStopLine()) { skipLine = true; } } if (!skipLine) { sb.append(line); sb.append("\n"); } lineNumber++; } save(sb.toString()); GyroCore.ui().write("\n"); invalidNodes.stream() .map(this::toPluginString) .map(p -> String.format("@|bold %s|@ was not installed.%n", p)) .forEach(GyroCore.ui()::write); removeNodes.stream() .map(this::toPluginString) .map(p -> String.format("@|bold %s|@ has been removed.%n", p)) .forEach(GyroCore.ui()::write); }
Example 5
Source File: Secret.java From strongbox with Apache License 2.0 | 4 votes |
@Override public void run() { Help.help(StrongboxCLI.globalMetadata, Collections.singletonList("secret")); }
Example 6
Source File: Group.java From strongbox with Apache License 2.0 | 4 votes |
@Override public void run() { Help.help(StrongboxCLI.globalMetadata, Collections.singletonList("group")); }
Example 7
Source File: AbstractMain.java From brooklyn-server with Apache License 2.0 | 4 votes |
protected String getUsageInfo(Cli<BrooklynCommand> parser) { StringBuilder help = new StringBuilder(); help.append("\n"); Help.help(parser.getMetadata(), Collections.<String>emptyList(), help); return help.toString(); }