if(completion.hasItems()) { out.println(); String[] list = completion.getItems(); for(int i = 0 ; i < list.length ; i++) out.println(list[i]); }  if(completion.needNewPrompt()) { out.print(currentPrompt + currentLine.getContent()); currentLine.start(console, true); }
    CompletionInfo complete(String partial) {        // workaround to set the currentShell to this shell        try {            ShellUtils.getShellManager().registerShell(this);        } catch (NameNotFoundException ex) {        }        completion = new CompletionInfo();        String result = null;        try {            CommandLine cl = new CommandLine(partial);            String cmd = "";            if (cl.hasNext()) {                cmd = cl.next();                if (!cmd.trim().equals("") && cl.hasNext())                        try {                            // get command's help info                            Class cmdClass = getCommandClass(cmd);                            Help.Info info = Help.getInfo(cmdClass);                            // perform completion                            result = cmd + " " + info.complete(cl); // prepend                            completion.setCompleted(result);                            // command                            // name and                            // space                            // again                        } catch (ClassNotFoundException ex) {                            throw new CompletionException(                                    "Command class not found");                        } catch (HelpException ex) {                            ex.printStackTrace();                            throw new CompletionException(                                    "Command class not found");                        }            }            if (result == null) // assume this is the alias to be called                    result = defaultArg.complete(cmd);            if (!partial.equals(result) && !completion.hasItems())            {             	// performed direct                // completion without listing            	completion.setCompleted(result);				completion.setNewPrompt(false);            	            }        } catch (CompletionException ex) {            out.println(); // next line            err.println(ex.getMessage()); // print the error (optional)            // this debug output is to trace where the Exception came from            //ex.printStackTrace(err);            // restore old value and need a new prompt             completion.setCompleted(partial);            completion.setNewPrompt(true);        }		if(completion.hasItems())		{			out.println();			String[] list = completion.getItems();			for(int i = 0 ; i < list.length ; i++)				out.println(list[i]);		}				if(completion.needNewPrompt())		{				        out.print(currentPrompt + currentLine.getContent());	        currentLine.start(console, true);						}		        return completion;    }