Use requires_segment_info decorator on shell segments

This commit is contained in:
Kim Silkebækken 2013-02-12 10:52:17 +01:00
parent e89e083fee
commit 9aee288c18
1 changed files with 4 additions and 2 deletions

View File

@ -1,12 +1,15 @@
# -*- coding: utf-8 -*-
from powerline.theme import requires_segment_info
@requires_segment_info
def last_status(segment_info):
'''Return last exit code.'''
return str(segment_info.last_exit_code) if segment_info.last_exit_code else None
last_status.requires_powerline_segment_info = True
@requires_segment_info
def last_pipe_status(segment_info):
'''Return last pipe status.'''
if any(segment_info.last_pipe_status):
@ -14,4 +17,3 @@ def last_pipe_status(segment_info):
for status in segment_info.last_pipe_status]
else:
return None
last_pipe_status.requires_powerline_segment_info = True