diff --git a/mdrsclient/commands/ls.py b/mdrsclient/commands/ls.py index 86cbcf0..d9d2dfa 100644 --- a/mdrsclient/commands/ls.py +++ b/mdrsclient/commands/ls.py @@ -82,7 +82,7 @@ class LsCommand(BaseCommand): "type": "Type", "acl": "Access", "laboratory": "Laboratory", - "size": "Lock/Size", + "size": "Size", "date": "Date", "name": "Name", } @@ -94,7 +94,7 @@ class LsCommand(BaseCommand): sub_laboratory_name = sub_laboratory.name if sub_laboratory is not None else "(invalid)" length["acl"] = max(length["acl"], len(sub_folder.access_level_name)) length["laboratory"] = max(length["laboratory"], len(sub_laboratory_name)) - length["size"] = max(length["size"], len(sub_folder.lock_name)) + length["size"] = max(length["size"], len(str(folder.size))) length["date"] = max(length["date"], len(sub_folder.updated_at_name)) length["name"] = max(length["name"], len(sub_folder.name)) for file in folder.files: @@ -119,9 +119,10 @@ class LsCommand(BaseCommand): for sub_folder in sorted(folder.sub_folders, key=lambda x: x.name): sub_laboratory_name = cls._laboratory_name(context, sub_folder.laboratory_id) + sub_folder_type = "[d]" if sub_folder.lock is False else "[l]" print( - f"{'[d]':{length['type']}}\t{sub_folder.access_level_name:{length['acl']}}\t" - f"{sub_laboratory_name:{length['laboratory']}}\t{sub_folder.lock_name:{length['size']}}\t" + f"{sub_folder_type:{length['type']}}\t{sub_folder.access_level_name:{length['acl']}}\t" + f"{sub_laboratory_name:{length['laboratory']}}\t{sub_folder.size:{length['size']}}\t" f"{sub_folder.updated_at_name:{length['date']}}\t{sub_folder.name:{length['name']}}" ) for file in sorted(folder.files, key=lambda x: x.name): @@ -149,6 +150,7 @@ class LsCommand(BaseCommand): "id": folder.id, "pid": folder.pid, "name": folder.name, + "size": folder.size, "access_level": folder.access_level_name, "lock": folder.lock, "laboratory": cls._laboratory_name(context, folder.laboratory_id), diff --git a/mdrsclient/models/folder.py b/mdrsclient/models/folder.py index 23d3d00..e5476d3 100644 --- a/mdrsclient/models/folder.py +++ b/mdrsclient/models/folder.py @@ -15,7 +15,7 @@ class FolderAccessLevelItem(NamedTuple): class FolderAccessLevel: # Bit Mask - # - bit 0: Storage or Repository + # - bit 0: Is Private # - bit 1: Is Public # - bit 2: With Password # - bit 3-7: (Reserved) @@ -49,6 +49,7 @@ class FolderSimple: name: str access_level: int lock: bool + size: int laboratory_id: int description: str created_at: str