mirror of
https://github.com/powerline/powerline.git
synced 2025-04-08 19:25:04 +02:00
No need to bother both developers (that need to create class names compatible with file name, which is not obvious if not looking into main Powerline class) and computer (that needs to recompute class name each time) if it is possible to bother only developers (or only computer, but this contributes to higher startup times). About not obvious: when you look into zsh_prompt.py and see only ZshPromptRenderer name you only think that powerline upstream is following strict code style. You don’t think there is a technical reason for such naming, like you don’t think there is technical reason for having blank lines. When you look into zsh_prompt.py and see `renderer = ZshPromptRenderer` it is obvious that there is technical reason for writing code this way because new variable is never used in the module itself.
17 lines
366 B
Python
17 lines
366 B
Python
# vim:fileencoding=utf-8:noet
|
|
|
|
from powerline.renderers.shell import ShellRenderer
|
|
|
|
|
|
class BashPromptRenderer(ShellRenderer):
|
|
'''Powerline bash prompt segment renderer.'''
|
|
escape_hl_start = '\['
|
|
escape_hl_end = '\]'
|
|
|
|
@staticmethod
|
|
def escape(string):
|
|
return string.replace('\\', '\\\\').replace('$', '\\$').replace('`', '\\`')
|
|
|
|
|
|
renderer = BashPromptRenderer
|