Prompt Toolkit Shell (xonsh.ptk.shell)

The prompt_toolkit based xonsh shell.

class xonsh.ptk.shell.PromptToolkitShell(**kwargs)[source]

The xonsh shell.

bottom_toolbar_tokens(cli)[source]

Returns a list of (token, str) tuples for the current bottom toolbar.

cmdloop(intro=None)[source]

Enters a loop that reads and execute input from user.

color_style()[source]

Returns the current color map.

color_style_names()[source]

Returns an iterable of all available style names.

compile(src)

Compiles source code and returns the (possibly modified) source and a valid code object.

continuation_tokens(cli, width)[source]

Displays dots in multiline prompt

default(line)

Implements code execution.

emptyline()

Called when an empty line has been entered.

format_color(string, hide=False, force_string=False, **kwargs)[source]

Formats a color string using Pygments. This, therefore, returns a list of (Token, str) tuples. If force_string is set to true, though, this will return a color formatted string.

precmd(line)

Called just before execution of line.

print_color(string, end='\n', **kwargs)[source]

Prints a color string using prompt-toolkit color management.

prompt_tokens(cli)[source]

Returns a list of (token, str) tuples for the current prompt.

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.

restore_tty_sanity()[source]

An interface for resetting the TTY stdin mode. This is highly dependent on the shell backend. Also it is mostly optional since it only affects ^Z backgrounding behaviour.

rprompt_tokens(cli)[source]

Returns a list of (token, str) tuples for the current right prompt.

settitle()

Sets terminal title.

singleline(store_in_history=True, auto_suggest=None, enable_history_search=True, multiline=True, **kwargs)[source]

Reads a single line of input from the shell. The store_in_history kwarg flags whether the input should be stored in PTK’s in-memory history.

prompt

Obtains the current prompt string.

styler