@DefaultCommand public void exit() { shutdown.fire(new Shutdown(Shutdown.Status.NORMAL)); } }
@DefaultCommand public void run(PipeOut out) { forge.about(out); } }
@DefaultCommand public void reset() { reinitializeEvent.fire(new ReinitializeEnvironment()); } }
@DefaultCommand(help = "Add many custom field to an existing @Entity class") public void newExpressionField( @Option(required = true, description = "The field descriptor") final String... fields) { System.out.println(Arrays.asList(fields)); }
@DefaultCommand public void waitCommand() { shell.prompt("Press <ENTER> to continue..."); } }
@DefaultCommand public void run() { shell.clear(); } }
@DefaultCommand(help = "Prints all Java system property information.") public void info(final PipeOut out) { for (Entry<Object, Object> entry : System.getProperties().entrySet()) { if (entry.getKey().toString().startsWith("java")) { out.print(ShellColor.BOLD, entry.getKey().toString() + ": "); out.println(entry.getValue().toString()); } } }
@DefaultCommand public void run(@PipeIn InputStream pipeIn, final Resource<?> file, final PipeOut pipeOut) throws IOException { morePlugin.run(pipeIn, file, true, pipeOut); } }
@DefaultCommand public void show(final PipeOut out) { String version = environment.getRuntimeVersion(); out.println("JBoss Forge, version [ " + version + " ] - JBoss, by Red Hat, Inc. [ http://jboss.org/forge ]"); } }
@DefaultCommand public void run(final PipeOut out, final String... parms) throws IOException { NativeSystemCall.execFromPath("git", parms, out, shell.getCurrentDirectory()); }
@DefaultCommand public void run( @Option(description = "The starting resource to be listed", defaultValue = ".") final Resource<?> r, PipeOut out) throws IOException { listResources(out, r); }
@DefaultCommand public void run(final PipeOut out, final String... parms) { project.getFacet(MavenCoreFacet.class).executeMaven(out, parms); } }
@DefaultCommand public void set(final PipeOut out, @Option(help = "The alias name to remove: E.g: 'mycommand'") final String[] aliases) { if ((aliases != null) && (aliases.length > 0)) { for (String alias : aliases) { registry.removeAlias(alias); } } } }
@DefaultCommand public void build(final PipeOut out, @Option(name = "profile", completer = ProfileCompleter.class) String profile, @Option(description = "test arguments") String... args) { PackagingFacet packaging = project.getFacet(PackagingFacet.class); List<String> arguments = new ArrayList<String>(); arguments.add("test"); if (args != null) arguments.addAll(Arrays.asList(args)); if (profile != null) { arguments.add("-P" + profile); } packaging.executeBuild(arguments.toArray(new String[] {})); }
@DefaultCommand public void set(final PipeOut out, @Option(help = "The alias definition: E.g: 'ls=ls -a'") final String[] tokens) { if ((tokens != null) && (tokens.length > 0)) { String definition = Strings.join(Arrays.asList(tokens), " "); if (definition.contains("=")) { String alias = definition.substring(0, definition.indexOf("=")).trim(); String command = definition.substring(definition.indexOf("=") + 1).trim(); registry.createAlias(alias, command); } } else { for (Entry<String, String> alias : registry.getAliases().entrySet()) { out.println(alias.getKey() + " = " + alias.getValue()); } } } }
@DefaultCommand public void listProperties() { Map<String, Object> properties = forge.getProperties(); for (Entry<String, Object> entry : properties.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); writer.print(key + "="); if (value != null) { writer.print(value.toString()); } writer.println(); } } }
@DefaultCommand public void mkdir( @Option(help = "name of directory to be created", required = true) final String name) { FileResource<?> newResource = (FileResource<?>) currentDir.getChild(name); if (newResource.exists()) { throw new RuntimeException(String.format("cannot create directory '%s': File exists", name)); } else if (!newResource.mkdirs()) { throw new RuntimeException("failed to create directory: " + name); } } }
@DefaultCommand public void run(@Option(description = "url...", required = true) final String url, final PipeOut pipeOut, final String... args)
@DefaultCommand public void run( @Option(description = "The plugins to set up", required = true, completer = SetupPluginCompleter.class) final String[] plugins, final PipeOut out) throws Exception { for (String plugin : plugins) { if (completer.getCompletionTokens().contains(plugin)) { shell.execute(plugin + " setup"); } else if (registry.getPluginMetadataForScopeAndConstraints(plugin, shell) != null) { throw new RuntimeException("Plugin does not have a [setup] method."); } else { throw new RuntimeException("No such plugin [" + plugin + "], or plugin not available for current Resource [" + resource.getClass().getName() + "]"); } } } }