1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-24 15:12:00 +00:00

--sort-by: support "archive" as alias of "name", fixes #7873

This commit is contained in:
Thomas Waldmann 2023-10-27 20:46:03 +02:00
parent 1f48e500f2
commit fa1e9df0d1
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01
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")