public TShellCompletor(Shell shell) { super((Completor)null); this.shell = shell; this.commandCompletor = new SimpleCompletor(shell.getCommandNames()); completors = new HashMap<String, Completor[]>(); completors.put("help", new Completor[]{commandCompletor, commandCompletor, new NullCompletor()}); completors.put("install", new Completor[]{commandCompletor, new InstallCompletor(shell)}); completors.put("installed", new Completor[]{commandCompletor, new ICURICompletor(shell), new NullCompletor()}); completors.put("invoke", new Completor[]{commandCompletor, new ServiceCompletor(shell), new ServiceOperationCompletor(shell), new NullCompletor()}); completors.put("load", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()}); completors.put("remove", new Completor[]{commandCompletor, new ICURICompletor(shell), new NullCompletor()}); completors.put("run", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()}); completors.put("save", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()}); completors.put("start", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new RemoteNodeCompletor(shell), new NullCompletor()}); completors.put("started", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()}); completors.put("stop", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()}); for (Command c : shell.getCommands().values()) { List<Completor> compleors = new ArrayList<Completor>(); compleors.add(commandCompletor); compleors.addAll(Arrays.asList(c.getCompletors())); completors.put(c.getName(), compleors.toArray(new Completor[]{})); } }
public TShellCompletor(Shell shell) { super((Completor)null); this.shell = shell; this.commandCompletor = new SimpleCompletor(shell.getCommandNames()); completors = new HashMap<String, Completor[]>(); completors.put("help", new Completor[]{commandCompletor, commandCompletor, new NullCompletor()}); completors.put("install", new Completor[]{commandCompletor, new InstallCompletor(shell)}); completors.put("installed", new Completor[]{commandCompletor, new ICURICompletor(shell), new NullCompletor()}); completors.put("invoke", new Completor[]{commandCompletor, new ServiceCompletor(shell), new ServiceOperationCompletor(shell), new NullCompletor()}); completors.put("load", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()}); completors.put("remove", new Completor[]{commandCompletor, new ICURICompletor(shell), new NullCompletor()}); completors.put("run", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()}); completors.put("save", new Completor[]{commandCompletor, new FileNameCompletor(), new NullCompletor()}); completors.put("start", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new RemoteNodeCompletor(shell), new NullCompletor()}); completors.put("started", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()}); completors.put("stop", new Completor[]{commandCompletor, new ICURICompletor(shell), new CompositeURICompletor(shell), new NullCompletor()}); for (Command c : shell.getCommands().values()) { List<Completor> compleors = new ArrayList<Completor>(); compleors.add(commandCompletor); compleors.addAll(Arrays.asList(c.getCompletors())); completors.put(c.getName(), compleors.toArray(new Completor[]{})); } }