mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 13:55:45 +02:00
Add format keyword argument to network_load segment
This commit is contained in:
parent
f9e9b2cd22
commit
a1b0b6239f
@ -550,6 +550,8 @@ class NetworkLoadSegment(KwThreadedSegment):
|
|||||||
string appended to each load string
|
string appended to each load string
|
||||||
:param bool si_prefix:
|
:param bool si_prefix:
|
||||||
use SI prefix, e.g. MB instead of MiB
|
use SI prefix, e.g. MB instead of MiB
|
||||||
|
:param str format:
|
||||||
|
format string, receives ``recv`` and ``sent`` as arguments
|
||||||
'''
|
'''
|
||||||
|
|
||||||
interfaces = {}
|
interfaces = {}
|
||||||
@ -587,9 +589,9 @@ class NetworkLoadSegment(KwThreadedSegment):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
'contents': '⬇ {rx_diff} ⬆ {tx_diff}'.format(
|
'contents': format.format(
|
||||||
rx_diff=humanize_bytes((b2[0] - b1[0]) / measure_interval, suffix, si_prefix).rjust(8),
|
recv=humanize_bytes((b2[0] - b1[0]) / measure_interval, suffix, si_prefix),
|
||||||
tx_diff=humanize_bytes((b2[1] - b1[1]) / measure_interval, suffix, si_prefix).rjust(8),
|
sent=humanize_bytes((b2[1] - b1[1]) / measure_interval, suffix, si_prefix),
|
||||||
),
|
),
|
||||||
'divider_highlight_group': 'background:divider',
|
'divider_highlight_group': 'background:divider',
|
||||||
}]
|
}]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user