upysh: ls: Print file size/directory type.

pull/76/head
Paul Sokolovsky 2016-06-01 00:10:12 +03:00
rodzic 459c8969bc
commit 893d03aabd
1 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

@ -4,15 +4,18 @@ import os
class LS:
def __repr__(self):
l = os.listdir()
l.sort()
return "\n".join(l)
self.__call__()
return ""
def __call__(self, path="."):
l = os.listdir(path)
l.sort()
for f in l:
print(f)
st = os.stat("%s/%s" % (path, f))
if st[0] & 0x4000: # stat.S_IFDIR
print(" <dir> %s" % f)
else:
print("% 8d %s" % (st[6], f))
class PWD: