Rename "terminal" extension to "shell"

Refs #84.
This commit is contained in:
Kim Silkebækken 2013-01-21 10:48:14 +01:00
parent 45769b2907
commit 0b385a11e0
4 changed files with 4 additions and 16 deletions

View File

@ -12,7 +12,7 @@
}
},
"ext": {
"terminal": {
"shell": {
"colorscheme": "default",
"theme": "default"
},

View File

@ -1,22 +1,10 @@
# -*- coding: utf-8 -*-
import os
from powerline.renderer import Renderer
class TerminalRenderer(Renderer):
'''Powerline terminal segment renderer.'''
_color_templates = {
'default': '[{code}m',
'zsh': '%{{[{code}m%}}',
}
def __init__(self, *args, **kwargs):
super(TerminalRenderer, self).__init__(*args, **kwargs)
shell = os.path.basename(os.environ.get('SHELL'))
self.color_template = self._color_templates.get(shell, self._color_templates['default'])
class ShellRenderer(Renderer):
'''Powerline shell segment renderer.'''
def hl(self, fg=None, bg=None, attr=None):
'''Highlight a segment.
@ -41,4 +29,4 @@ class TerminalRenderer(Renderer):
else:
if attr & Renderer.ATTR_BOLD:
ansi += [1]
return self.color_template.format(code=';'.join(str(attr) for attr in ansi))
return '[{0}m'.format(';'.join(str(attr) for attr in ansi))