Readline Shell (xonsh.readline_shell
)¶
The readline based xonsh shell.
Portions of this code related to initializing the readline library are included from the IPython project. The IPython project is:
- Copyright (c) 2008-2014, IPython Development Team
- Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>
- Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>
- Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>
-
class
xonsh.readline_shell.
ReadlineHistoryAdder
(wait_for_gc=True, *args, **kwargs)[source]¶ Thread responsible for adding inputs from history to the current readline instance. May wait for the history garbage collector to finish.
-
getName
()¶
-
isAlive
()¶ Return whether the thread is alive.
This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads.
-
isDaemon
()¶
-
is_alive
()¶ Return whether the thread is alive.
This method returns True just before the run() method starts until just after the run() method terminates. The module function enumerate() returns a list of all alive threads.
-
join
(timeout=None)¶ Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is called terminates – either normally or through an unhandled exception or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call isAlive() after join() to decide whether a timeout happened – if the thread is still alive, the join() call timed out.
When the timeout argument is not present or None, the operation will block until the thread terminates.
A thread can be join()ed many times.
join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.
-
setDaemon
(daemonic)¶
-
setName
(name)¶
-
start
()¶ Start the thread’s activity.
It must be called at most once per thread object. It arranges for the object’s run() method to be invoked in a separate thread of control.
This method will raise a RuntimeError if called more than once on the same thread object.
-
daemon
¶ A boolean value indicating whether this thread is a daemon thread.
This must be set before start() is called, otherwise RuntimeError is raised. Its initial value is inherited from the creating thread; the main thread is not a daemon thread and therefore all threads created in the main thread default to daemon = False.
The entire Python program exits when no alive non-daemon threads are left.
-
ident
¶ Thread identifier of this thread or None if it has not been started.
This is a nonzero integer. See the thread.get_ident() function. Thread identifiers may be recycled when a thread exits and another thread is created. The identifier is available even after the thread has exited.
-
name
¶ A string used for identification purposes only.
It has no semantics. Multiple threads may be given the same name. The initial name is set by the constructor.
-
-
class
xonsh.readline_shell.
ReadlineShell
(completekey='tab', stdin=None, stdout=None, **kwargs)[source]¶ The readline based xonsh shell.
-
columnize
(list, displaywidth=80)¶ Display a list of strings as a compact set of columns.
Each column is only as wide as necessary. Columns are separated by two spaces (one was not legible enough).
-
complete
(text, state)¶ Return the next possible completion for ‘text’.
If a command has not been entered, then complete against command list. Otherwise try to call complete_<command> to get list of completions.
-
complete_help
(*args)¶
-
completenames
(text, line, begidx, endidx)¶ Implements tab-completion for text.
-
default
(line)¶ Implements code execution.
-
do_help
(arg)¶ List available commands with “help” or detailed help with “help cmd”.
-
emptyline
()¶ Called when an empty line has been entered.
-
format_color
(string, hide=False, **kwargs)[source]¶ Readline implementation of color formatting. This usesg ANSI color codes.
-
get_names
()¶
-
onecmd
(line)¶ Interpret the argument as though it had been typed in response to the prompt.
This may be overridden, but should not normally need to be; see the precmd() and postcmd() methods for useful execution hooks. The return value is a flag indicating whether interpretation of commands by the interpreter should stop.
-
postcmd
(stop, line)[source]¶ Called just before execution of line. For readline, this handles the automatic indentation of code blocks.
-
postloop
()¶ Hook method executed once when the cmdloop() method is about to return.
-
precmd
(line)¶ Called just before execution of line.
-
preloop
()¶ Hook method executed once when the cmdloop() method is called.
-
print_topics
(header, cmds, cmdlen, maxcol)¶
-
push
(line)¶ Pushes a line onto the buffer and compiles the code in a way that enables multiline input.
-
reset_buffer
()¶ Resets the line buffer.
-
settitle
()¶ Sets terminal title.
-
singleline
(store_in_history=True, **kwargs)[source]¶ Reads a single line of input. The store_in_history kwarg flags whether the input should be stored in readline’s in-memory history.
-
doc_header
= 'Documented commands (type help <topic>):'¶
-
doc_leader
= ''¶
-
identchars
= 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'¶
-
intro
= None¶
-
lastcmd
= ''¶
-
misc_header
= 'Miscellaneous help topics:'¶
-
nohelp
= '*** No help on %s'¶
-
prompt
¶ Obtains the current prompt string.
-
ruler
= '='¶
-
undoc_header
= 'Undocumented commands:'¶
-
use_rawinput
= 1¶
-
-
xonsh.readline_shell.
fix_readline_state_after_ctrl_c
()[source]¶ Fix to allow Ctrl-C to exit reverse-i-search.
- Based on code from:
- http://bugs.python.org/file39467/raw_input__workaround_demo.py
-
xonsh.readline_shell.
rl_completion_suppress_append
(val=1)[source]¶ Sets the rl_completion_suppress_append varaiable, if possible. A value of 1 (default) means to suppress, a value of 0 means to enable.
-
xonsh.readline_shell.
rl_variable_dumper
(readable=True)[source]¶ Dumps the currently set readline variables. If readable is True, then this output may be used in an inputrc file.
-
xonsh.readline_shell.
rl_variable_value
(variable)[source]¶ Returns the currently set value for a readline configuration variable.