socialnerds/hive
socialnerds
/
hive
Archived
1
0
Fork 0

nicer output in disk display

This commit is contained in:
David 2012-05-20 23:11:40 +02:00
parent 4e3aee7738
commit c2dd867ae3
1 changed files with 4 additions and 1 deletions

View File

@ -26,9 +26,12 @@ if __name__ == "__main__":
if partition.has_key("mountpoint"):
totalbytes = blocks2bytes(partition["total blocks"], partition["blocksize"])
totalhuman = bytes2human(totalbytes)
freebytes = blocks2bytes(partition["free blocks"], partition["blocksize"])
freehuman = bytes2human(freebytes)
percent = 100.00 * freebytes / totalbytes
print "Mountpoint:\t" + str(partition["mountpoint"]) + \
"\nFilesystem:\t" + str(partition["filesystem"]) + \
"\nSize:\t\t%.2f %s\n" %(totalhuman[0], totalhuman[1])
"\nUsage:\t\t%.2f%s/%.2f%s(%i)\n" %(freehuman[0], freehuman[1], totalhuman[0], totalhuman[1], percent)
else:
print "\n"