Merge pull request #7909 from ThomasWaldmann/sort-by-aliases-master

--sort-by: support "archive" as alias of "name", fixes #7873
This commit is contained in:
TW 2023-11-05 19:08:25 +01:00 committed by GitHub
commit fba3e388aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -290,7 +290,7 @@ def SortBySpec(text):
for token in text.split(","):
if token not in AI_HUMAN_SORT_KEYS:
raise argparse.ArgumentTypeError("Invalid sort key: %s" % token)
return text.replace("timestamp", "ts")
return text.replace("timestamp", "ts").replace("archive", "name")
def format_file_size(v, precision=2, sign=False, iec=False):

View File

@ -28,7 +28,8 @@ class MandatoryFeatureUnsupported(Error):
ArchiveInfo = namedtuple("ArchiveInfo", "name id ts")
AI_HUMAN_SORT_KEYS = ["timestamp"] + list(ArchiveInfo._fields)
# timestamp is a replacement for ts, archive is an alias for name (see SortBySpec)
AI_HUMAN_SORT_KEYS = ["timestamp", "archive"] + list(ArchiveInfo._fields)
AI_HUMAN_SORT_KEYS.remove("ts")