@DefaultCommand public void run( @Option(help = "The text to be echoed") final String[] tokens, final PipeOut out) { if (tokens == null || tokens.length == 0) { return; } out.println(echo(shell, promptExpressionParser(shell, tokensToString(tokens)))); }
@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 rename( @Option(description = "source", required = true) final Resource<?> source, @Option(description = "target", required = true) final String target, @Option(name = "force", shortName = "f", description = "force operation", flagOnly = true) final boolean force, final PipeOut out) { Resource<?> directory = this.directory; rename(source, directory, target, force, out); }
/** * @author Mike Brock . */ @Alias("wait") @Topic("Shell Environment") @Help("Wait for ENTER.") public class WaitPlugin implements Plugin { private final Shell shell; @Inject public WaitPlugin(final Shell shell) { this.shell = shell; } @DefaultCommand public void waitCommand() { shell.prompt("Press <ENTER> to continue..."); } }
/** * @author Mike Brock . * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("mvn") @Topic("Project") @RequiresProject @RequiresFacet(MavenCoreFacet.class) public class MvnShellPlugin implements Plugin { private final Project project; @Inject public MvnShellPlugin(final Project project) { this.project = project; } @DefaultCommand public void run(final PipeOut out, final String... parms) { project.getFacet(MavenCoreFacet.class).executeMaven(out, parms); } }
/** * Forge facet for Common Component functionality. */ @Alias("switchyard.common") @RequiresFacet({ DependencyFacet.class, PackagingFacet.class, SwitchYardFacet.class }) @RequiresPackagingType(PackagingType.JAR) public class CommonFacet extends AbstractFacet { private static final String COMMON_MAVEN_ID = "org.switchyard.components:switchyard-component-common"; @Override public boolean install() { installDependencies(); return true; } /** * Create a new Common Facet. */ public CommonFacet() { super(COMMON_MAVEN_ID); } }
@Command("set-name") public void setName(final PipeOut out, @Option(description = "the new name; for example: \"UI-Layer\"") final String name) { Assert.notNull(name, "Name must not be empty"); MavenCoreFacet mvn = project.getFacet(MavenCoreFacet.class); Model pom = mvn.getPOM(); pom.setName(name); mvn.setPOM(pom); out.println("Set name [ " + name + " ]"); }
@DefaultCommand public void rm( @Option(name = "recursive", shortName = "r", help = "recursively delete resources", flagOnly = true) final boolean recursive, @Option(name = "force", shortName = "f", help = "do not prompt to confirm operations", flagOnly = true) final boolean force, @Option(description = "path", required = true) final Resource<?>[] paths) { for (Resource<?> resource : paths) { deleteResource(recursive, force, resource); } }
@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); } } } }
@Command("add-plugin") public void addPlugin( @Option(description = "dependency identifier of plugin, ex: \"org.jboss.forge:forge-maven-plugin:1.0.0.Final\"", required = true) final Dependency gav, final PipeOut out) { MavenPluginBuilder plugin = MavenPluginBuilder.create().setDependency(gav); if (!mavenPluginInstaller.isInstalled(project, plugin)) { mavenPluginInstaller.install(project, plugin); } }
/** * Print SwitchYard version used in this application. * @param out shell output */ @Command(value = "get-version", help = "Show the version of SwitchYard used by this application.") public void getVersion(final PipeOut out) { String version = _project.getFacet(SwitchYardFacet.class).getVersion(); out.println("SwitchYard version " + version); }
@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 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(@PipeIn InputStream pipeIn, final Resource<?> file, final PipeOut pipeOut) throws IOException { morePlugin.run(pipeIn, file, true, pipeOut); } }
/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("reset") @Topic("Shell Environment") @Help("Reset the shell and reload default configs.") public class ResetPlugin implements Plugin { private final Event<ReinitializeEnvironment> reinitializeEvent; @Inject public ResetPlugin(final Event<ReinitializeEnvironment> reinitializeEvent) { this.reinitializeEvent = reinitializeEvent; } @DefaultCommand public void reset() { reinitializeEvent.fire(new ReinitializeEnvironment()); } }
/** * @author <a href="mailto:rdruss@gmail.com">Rodney Russ</a> */ @Alias("pwr") @Topic("File & Resources") @Help("Prints the current working resource.") public class PwrPlugin implements org.jboss.forge.shell.plugins.Plugin { @Inject private Shell shell; @DefaultCommand public void run() { shell.println(shell.getCurrentResource().getFullyQualifiedName()); } }
/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("pwd") @Topic("File & Resources") @Help("Prints the current directory.") public class PwdPlugin implements Plugin { @Inject Shell shell; @DefaultCommand public void run() { shell.println(shell.getCurrentDirectory().getFullyQualifiedName()); } }
/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("version") @Topic("Shell Environment") @Help("Displays the current Forge version.") public class VersionPlugin implements Plugin { @Inject private ForgeEnvironment environment; @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 ]"); } }