Skip to content

Commit

Permalink
Removing already informed params
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Aug 17, 2013
1 parent d115aa5 commit 70062cd
Showing 1 changed file with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.List;
import java.util.logging.Logger;

import org.jboss.aesh.cl.CommandLine;
import org.jboss.aesh.cl.ParsedCompleteObject;
import org.jboss.aesh.cl.exception.CommandLineParserException;
import org.jboss.aesh.cl.internal.ParameterInt;
Expand All @@ -23,7 +22,6 @@
import org.jboss.forge.addon.resource.FileResource;
import org.jboss.forge.addon.shell.ShellImpl;
import org.jboss.forge.addon.shell.aesh.ShellCommand;
import org.jboss.forge.addon.ui.facets.HintsFacet;
import org.jboss.forge.addon.ui.hints.InputType;
import org.jboss.forge.addon.ui.input.HasCompleter;
import org.jboss.forge.addon.ui.input.InputComponent;
Expand Down Expand Up @@ -60,16 +58,7 @@ public void complete(CompleteOperation completeOperation)
ParsedCompleteObject completeObject = cmd.parseCompleteObject(line);
List<String> optionNames = param.getOptionLongNamesWithDash();

try
{
CommandLine commandLine = cmd.parse(line);
removeExistingOptions(commandLine, optionNames);
cmd.populateInputs(commandLine);
}
catch (CommandLineParserException parseException)
{
// ignore for now
}
removeExistingOptions(line, optionNames);

if (completeObject.doDisplayOptions())
{
Expand Down Expand Up @@ -122,12 +111,12 @@ else if (completeObject.isArgument())
}
}

private void removeExistingOptions(CommandLine commandLine, List<String> availableOptions)
private void removeExistingOptions(String commandLine, Iterable<String> availableOptions)
{
Iterator<String> it = availableOptions.iterator();
while (it.hasNext())
{
if (commandLine.hasOption(it.next()))
if (commandLine.contains(it.next()))
{
it.remove();
}
Expand Down Expand Up @@ -261,7 +250,7 @@ private void argumentCompletion(CompleteOperation completeOperation, ParsedCompl
ShellCommand shellCommand)
{
InputComponent inputOption = shellCommand.getInputs().get("arguments"); // default for arguments
// InputType inputType = ((HintsFacet) inputOption.getFacet(HintsFacet.class)).getInputType();
// InputType inputType = ((HintsFacet) inputOption.getFacet(HintsFacet.class)).getInputType();
InputType inputType = InputType.FILE_PICKER;
// use the arguments completor as default if it has any
if (inputOption != null
Expand Down

0 comments on commit 70062cd

Please sign in to comment.