def __init__(self, printUnsupported=False): ReadlineWrapper.__init__(self) self.printUnsupported=printUnsupported self.completeFunc=Readline.getCompleter() self.initFunc=None Readline.setCompleter(self) pass
def __init__(self, printUnsupported=False): ReadlineWrapper.__init__(self) self.printUnsupported = printUnsupported self.completeFunc = Readline.getCompleter() self.initFunc = None Readline.setCompleter(self) pass
def set_completer(completionfunction = None): """Set or remove the completer instance. If an instance of ReadlineCompleter is specified, it will be used as the new completer; if omitted or None, any completer already installed is removed. The completer method is called as completerclass.completer(text, state), for state in 0, 1, 2, ..., until it returns a non-string value. It should return the next possible completion starting with text. """ class DerivedCompleter (ReadlineCompleter): def __init__ (self, method): self.method = method def completer (self, text, state): return self.method(text, state) Readline.setCompleter(DerivedCompleter(completionfunction))
def parse_and_bind(self,string): """Parse and execute single line of a readline init file.""" return Readline.parseAndBind(string)
def read_history_file(filename): """Load a readline history file. The default filename is '~/.history'. """ Readline.readHistoryFile(filename)
def get_line_buffer(): """Return the current contents of the line buffer. """ return Readline.getLineBuffer()
def cleanup(): Readline.cleanup() pass
def clear_history(self): """Clear the current history. (Note: this function is not available if the installed version of GNU readline doesn’t support it.)""" Readline.clearHistory() pass
def read_history_file(self, filename): """Load a readline history file. The default filename is ~/.history.""" Readline.readHistoryFile(filename) pass
def parse_and_bind(self, string): """Parse and execute single line of a readline init file.""" return Readline.parseAndBind(string)
def read_init_file(filename): """Parse a readline initialization file. The default filename is the last filename used. """ Readline.readInitFile(filename)
def set_completer_delims(delimiters): """Set the readline word delimiters for tab-completion.""" Readline.setWordBreakCharacters(delimiters)
if sys.registry["python.console"] != "org.python.util.ReadlineConsole": raise EnvironmentError("You need to set python.console=org.python.util.ReadlineConsole in your ~/.jython file!") try: from org.gnu.readline import Readline, ReadlineLibrary, ReadlineCompleter except ImportError: raise ImportError("Make sure you have libreadline-java.jar in classpath!") import __builtin__ import atexit import keyword import os import re __all__ = ["PyCompleter", "JvCompleter"] Readline.load( getattr(ReadlineLibrary, sys.registry["python.console.readlinelib"], "") or DEFAULTLIB) histfile = os.path.join(os.environ["HOME"], ".jyhist") try: Readline.readHistoryFile(histfile) except: print >> sys.stderr, histfile, "not available!" atexit.register(Readline.writeHistoryFile, histfile) class PyCompleter: def __init__(self, namespace = None): """Create a new completer for the command line. PyCompleter([namespace]) -> completer instance. If unspecified, the default namespace where completions are performed
def get_current_history_length(): """Get the number of lines currently available in history.""" return Readline.getHistorySize()
def get_completer(): """Get the current completer instance.""" return Readline.getCompleter()
def write_history_file(filename): """Save a readline history file. The default filename is '~/.history'. """ Readline.writeHistoryFile(filename)
def add_history(line): """Append a line to the history buffer, as if it was the last line typed.""" Readline.addToHistory(line)
def get_line_buffer(self): """Return the current contents of the line buffer.""" return Readline.getLineBuffer()
def read_init_file(self,filename): """Parse a readline initialization file.""" Readline.readInitFile(filename) pass
def read_history_file(self,filename): """Load a readline history file. The default filename is ~/.history.""" Readline.readHistoryFile(filename) pass
def read_init_file(self, filename): """Parse a readline initialization file.""" Readline.readInitFile(filename) pass
def write_history_file(self,filename): """Save a readline history file. The default filename is ~/.history.""" Readline.writeHistoryFile(filename) pass
def write_history_file(self, filename): """Save a readline history file. The default filename is ~/.history.""" Readline.writeHistoryFile(filename) pass
def get_current_history_length(self): """Return the number of lines currently in the history.""" return Readline.getHistorySize()
def parse_and_bind (bindings): """Parse and execute single line of a readline init file.\ """ Readline.parseAndBind(bindings)
def set_completer_delims(self,string): """Set the readline word delimiters for tab-completion.""" Readline.setWordBreakCharacters(string)
def get_completer_delims(self): """Get the readline word delimiters for tab-completion.""" return str(Readline.getWordBreakCharacters())
def add_history(self,line): """Append a line to the history buffer, as if it was the last line typed.""" Readline.addToHistory(line)
def get_completer_delims(): """Get the readline word delimiters for tab-completion.""" return Readline.getWordBreakCharacters()
"You need to set python.console=org.python.util.ReadlineConsole in your ~/.jython file!" ) try: from org.gnu.readline import Readline, ReadlineLibrary, ReadlineCompleter except ImportError: raise ImportError("Make sure you have libreadline-java.jar in classpath!") import __builtin__ import atexit import keyword import os import re __all__ = ["PyCompleter", "JvCompleter"] Readline.load( getattr(ReadlineLibrary, sys.registry["python.console.readlinelib"], "") or DEFAULTLIB) histfile = os.path.join(os.environ["HOME"], ".jyhist") try: Readline.readHistoryFile(histfile) except: print >> sys.stderr, histfile, "not available!" atexit.register(Readline.writeHistoryFile, histfile) class PyCompleter: def __init__(self, namespace=None): """Create a new completer for the command line. PyCompleter([namespace]) -> completer instance.