Package org.jboss.forge.addon.shell

Examples of org.jboss.forge.addon.shell.Shell


   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Shell shell = (Shell) context.getUIContext().getProvider();
      TerminalSize terminalSize = shell.getConsole().getShell().getSize();
      List<String> display = new ArrayList<>();

      Set<CommandController> controllers = new TreeSet<>(new CommandControllerComparator());
      for (UICommand command : manager.getAllCommands())
      {
View Full Code Here


   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Shell shell = (Shell) context.getUIContext().getProvider();
      Resource<?> currentResource = shell.getCurrentResource();
      Iterator<String> it = arguments.hasValue() ? arguments.getValue().iterator() : Collections
               .<String> emptyIterator();

      List<Resource<?>> resourceList;
      if (it.hasNext())
      {
         String value = it.next();
         boolean searching = (value.matches(".*(\\?|\\*)+.*"));
         resourceList = new ResourcePathResolver(resourceFactory, currentResource, value).resolve();
         if (!searching && !resourceList.isEmpty() && resourceList.get(0).exists())
         {
            resourceList = resourceList.get(0).listResources();
         }
      }
      else
      {
         resourceList = currentResource.listResources();
      }
      final Result result;
      if (!resourceList.isEmpty() && !resourceList.get(0).exists())
      {
         result = Results.fail(resourceList.get(0).getName() + ": No such file or directory");
      }
      else
      {
         UIOutput output = shell.getOutput();
         output.out().println(listMany(resourceList, shell));
         result = Results.success();
      }
      return result;
   }
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Shell shell = (Shell) context.getUIContext().getProvider();
      TerminalSize terminalSize = shell.getConsole().getShell().getSize();
      List<String> display = new ArrayList<>();

      Set<CommandController> controllers = new TreeSet<>(new CommandControllerComparator());
      for (UICommand command : commandFactory.getCommands())
      {
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Shell shell = (Shell) context.getUIContext().getProvider();
      Resource<?> currentResource = shell.getCurrentResource();
      Iterator<String> it = arguments.getValue() == null ? Collections.<String> emptyList().iterator() : arguments
               .getValue().iterator();

      Result result = Results.success();
      UIOutput output = shell.getOutput();
      while (it.hasNext())
      {
         final Resource<?> resource = it.hasNext() ?
                  (new ResourcePathResolver(resourceFactory, currentResource, it.next()).resolve().get(0)) : currentResource;
View Full Code Here

                           .inputStream(new PipedInputStream(stdin))
                           .outputStream(stdout)
                           .outputStreamError(stderr)
                           .create();

                  Shell scriptShell = shellFactory.createShell(((FileResource<?>) context.getUIContext()
                           .getInitialSelection().get()).getUnderlyingResourceObject(), settings);

                  scriptShell.getConsole().setPrompt(new Prompt(""));

                  try (BufferedReader reader = new BufferedReader(new InputStreamReader(
                           resource.getResourceInputStream())))
                  {
                     long startTime = System.currentTimeMillis();
                     while (reader.ready())
                     {
                        try
                        {
                           String line = reader.readLine();
                           if (isComment(line))
                           {
                              // Skip Comments
                              continue;
                           }
                           Integer timeoutValue = timeout.getValue();
                           result = execute(scriptShell, writer, line, timeoutValue,
                                    TimeUnit.SECONDS, startTime);

                           if (result != null)
                           {
                              if (result instanceof Failed)
                                 break ALL;
                           }
                        }
                        catch (TimeoutException e)
                        {
                           result = Results.fail(path + ": timed out.");
                           break ALL;
                        }
                     }
                  }
                  finally
                  {
                     scriptShell.close();
                  }
               }
               else
               {
                  result = Results.fail(path + ": not found.");
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Shell shell = (Shell) context.getUIContext().getProvider();
      shell.getConsole().stop();
      forge.stop();
      return Results.success();
   }
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext context) throws Exception
   {
      Shell shell = (Shell) context.getUIContext().getProvider();
      shell.getConsole().clear();
      return Results.success();
   }
View Full Code Here

   }

   @Override
   public Result execute(UIExecutionContext shellContext) throws Exception
   {
      Shell provider = (Shell) shellContext.getUIContext().getProvider();
      UIOutput output = provider.getOutput();
      Resource<?> currentResource = provider.getCurrentResource();
      output.out().println(currentResource.getFullyQualifiedName());
      return Results.success();
   }
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.shell.Shell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.