1
1
şunun yansıması https://git.shadowkat.net/izaya/OC-PsychOS2.git eşitlendi 2024-09-28 15:12:45 -04:00
OC-PsychOS2/exec/df.lua

24 satır
574 B
Lua
Ham Normal Görünüm Geçmiş

2019-11-08 22:54:01 -05:00
local mt = fs.mounts()
local ml = 0
for k,v in pairs(mt) do
if v:len() > ml then
ml = v:len()
end
end
local scale = {"K","M","G","T","P"}
local function wrapUnits(n)
local count = 0
while n > 1024 do
count = count + 1
if not scale[count] then return "inf" end
n = n / 1024
end
2019-11-08 22:59:34 -05:00
return tostring(math.floor(n))..(scale[count] or "")
2019-11-08 22:54:01 -05:00
end
local fstr = "%-"..tostring(ml).."s %5s %5s"
print("fs"..(" "):rep(ml-2).." size used")
for k,v in pairs(mt) do
local st, su = fs.spaceTotal(v), fs.spaceUsed(v)
print(string.format(fstr,v,wrapUnits(st),wrapUnits(su)))
end