Package org.jboss.forge.shell.console.jline.console

Examples of org.jboss.forge.shell.console.jline.console.CursorBuffer


   @Override
   public boolean complete(final ConsoleReader reader, final List<CharSequence> candidates, final int pos) throws
            IOException
   {
      CursorBuffer buf = reader.getCursorBuffer();

      PluginCommandCompleterState state = commandHolder.getState();
      if (state != null)
      {
         if (((candidates.size() == 1) && "".equals(candidates.get(0)))
                  || (state.isDuplicateBuffer() && state.isFinalTokenComplete()))
         {
            if (commandHolder.getState().getOption() != null)
            {
               OptionMetadata option = commandHolder.getState().getOption();
               reader.println();
               reader.println(option.getOptionDescriptor());
               if (candidates.size() == 1)
               {
                  reader.println();
                  reader.drawLine();
                  return true;
               }
            }
         }
      }

      // if there is only one completion, then fill in the buffer
      if (candidates.size() == 1)
      {
         CharSequence value = candidates.get(0);

         // fail if the only candidate is the same as the current buffer
         if (value.equals(buf.toString()))
         {
            return false;
         }

         setBuffer(reader, value, pos);
View Full Code Here


    @Override
    public boolean complete(final ConsoleReader reader, final List<CharSequence> candidates, final int pos) throws
                IOException
    {
        CursorBuffer buf = reader.getCursorBuffer();

        PluginCommandCompleterState state = commandHolder.getState();
        if (state != null)
        {
            if (((candidates.size() == 1) && "".equals(candidates.get(0)))
                        || (state.isDuplicateBuffer() && state.isFinalTokenComplete()))
            {
                if (commandHolder.getState().getOption() != null)
                {
                    OptionMetadata option = commandHolder.getState().getOption();
                    reader.println();
                    reader.println(option.getOptionDescriptor());
                    if (candidates.size() == 1)
                    {
                        reader.println();
                        reader.drawLine();
                        return true;
                    }
                }
            }
        }

        // if there is only one completion, then fill in the buffer
        if (candidates.size() == 1)
        {
            String value = candidates.get(0).toString();
            // escape the spaces, except if it's the last character
            if (!Strings.isNullOrEmpty(value))
                value = value.substring(0, value.length() - 1).replace(" ", "\\ ")
                            + value.substring(value.length() - 1);

            // fail if the only candidate is the same as the current buffer
            if (value.equals(buf.toString()))
            {
                return false;
            }

            setBuffer(reader, value, pos);
View Full Code Here

   @Override
   public boolean complete(final ConsoleReader reader, final List<CharSequence> candidates, final int pos) throws
            IOException
   {
      CursorBuffer buf = reader.getCursorBuffer();

      PluginCommandCompleterState state = commandHolder.getState();
      if (state != null)
      {
         if (((candidates.size() == 1) && "".equals(candidates.get(0)))
                  || (state.isDuplicateBuffer() && state.isFinalTokenComplete()))
         {
            if (commandHolder.getState().getOption() != null)
            {
               OptionMetadata option = commandHolder.getState().getOption();
               reader.println();
               reader.println(option.getOptionDescriptor());
               if (candidates.size() == 1)
               {
                  reader.println();
                  reader.drawLine();
                  return true;
               }
            }
         }
      }

      // if there is only one completion, then fill in the buffer
      if (candidates.size() == 1)
      {
         String value = candidates.get(0).toString();
         // escape the spaces, except if it's the last character
         value = value.substring(0, value.length() - 1).replace(" ", "\\ ") + value.substring(value.length() - 1);

         // fail if the only candidate is the same as the current buffer
         if (value.equals(buf.toString()))
         {
            return false;
         }

         setBuffer(reader, value, pos);
View Full Code Here

   @Override
   public boolean complete(final ConsoleReader reader, final List<CharSequence> candidates, final int pos) throws
            IOException
   {
      CursorBuffer buf = reader.getCursorBuffer();

      PluginCommandCompleterState state = commandHolder.getState();
      if (state != null)
      {
         if (((candidates.size() == 1) && "".equals(candidates.get(0)))
                  || (state.isDuplicateBuffer() && state.isFinalTokenComplete()))
         {
            if (commandHolder.getState().getOption() != null)
            {
               OptionMetadata option = commandHolder.getState().getOption();
               reader.println();
               reader.println(option.getOptionDescriptor());
               if (candidates.size() == 1)
               {
                  reader.println();
                  reader.drawLine();
                  return true;
               }
            }
         }
      }

      // if there is only one completion, then fill in the buffer
      if (candidates.size() == 1)
      {
         String value = candidates.get(0).toString();
         // escape the spaces, except if it's the last character
         if (!Strings.isNullOrEmpty(value))
            value = value.substring(0, value.length() - 1).replace(" ", "\\ ")
                     + value.substring(value.length() - 1);

         // fail if the only candidate is the same as the current buffer
         if (value.equals(buf.toString()))
         {
            return false;
         }

         setBuffer(reader, value, pos);
View Full Code Here

TOP

Related Classes of org.jboss.forge.shell.console.jline.console.CursorBuffer

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.