| 1148 | METADATA = ("mode", "type", "owner", "group", "user", "mtime", "ctime") |
| 1149 | |
| 1150 | def __init__(self, format, content_only=False): |
| 1151 | static_data = {} | self.FIXED_KEYS |
| 1152 | super().__init__(format or "{content}{link}{directory}{blkdev}{chrdev}{fifo} {path}{NL}", static_data) |
| 1153 | self.content_only = content_only |
| 1154 | self.format_keys = {f[1] for f in Formatter().parse(format)} |
| 1155 | self.call_keys = { |
| 1156 | "content": self.format_content, |
| 1157 | "mode": self.format_mode, |
| 1158 | "type": partial(self.format_mode, filetype=True), |
| 1159 | "owner": partial(self.format_owner), |
| 1160 | "group": partial(self.format_owner, spec="group"), |
| 1161 | "user": partial(self.format_owner, spec="user"), |
| 1162 | "link": partial(self.format_other, "link"), |
| 1163 | "directory": partial(self.format_other, "directory"), |
| 1164 | "blkdev": partial(self.format_other, "blkdev"), |
| 1165 | "chrdev": partial(self.format_other, "chrdev"), |
| 1166 | "fifo": partial(self.format_other, "fifo"), |
| 1167 | "mtime": partial(self.format_time, "mtime"), |
| 1168 | "ctime": partial(self.format_time, "ctime"), |
| 1169 | "isomtime": partial(self.format_iso_time, "mtime"), |
| 1170 | "isoctime": partial(self.format_iso_time, "ctime"), |
| 1171 | } |
| 1172 | self.used_call_keys = set(self.call_keys) & self.format_keys |
| 1173 | if self.content_only: |
| 1174 | self.used_call_keys -= set(self.METADATA) |
| 1175 | |
| 1176 | def get_item_data(self, item: "ItemDiff", jsonline=False) -> dict: |
| 1177 | diff_data = {} |