mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-22 08:41:32 +03:00
Implement number and alias aware diskio sorting
This commit is contained in:
parent
0d029220dd
commit
56229d238a
@ -19,7 +19,7 @@
|
||||
|
||||
"""Disk I/O plugin."""
|
||||
|
||||
import operator
|
||||
import re
|
||||
|
||||
from glances.timer import getTimeSinceLastUpdate
|
||||
from glances.plugins.glances_plugin import GlancesPlugin
|
||||
@ -180,7 +180,10 @@ class Plugin(GlancesPlugin):
|
||||
msg = '{:>7}'.format('W/s')
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# Disk list (sorted by name)
|
||||
for i in sorted(self.stats, key=operator.itemgetter(self.get_key())):
|
||||
for i in sorted(self.stats, key=lambda stat: tuple(map(
|
||||
lambda part: int(part) if part.isdigit() else part.lower(),
|
||||
re.split(r"(\d+|\D+)", stat.get('alias') or stat['disk_name'])
|
||||
))):
|
||||
# Is there an alias for the disk name ?
|
||||
disk_real_name = i['disk_name']
|
||||
disk_name = self.has_alias(i['disk_name'])
|
||||
|
Loading…
Reference in New Issue
Block a user