From 22efee3d2efe9e79c90f53363f2d1118d393dec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Sat, 23 Jan 2016 20:49:12 -0500 Subject: [PATCH] disambiguate -p versus -P we now use -P for --prefix and -p for --progress. previously, the result of -p depended on the command: some were using it for --progress, some for --prefix. this was confusing and was making it impossible to both --progress and --prefix with on-letter options --progress is likely used more often and interactively, so it get the keystroke shortcut (lower "-p") --prefix is used more rarely / in scripts, but important/dangerous for prune, so it get the extra keystroke (higher "-P") If somebody used -p someprefix and does not fix that to -P, it will result in "no archive specified" or "unrecognized argument". So it will neither cause pruning to remove wrong data nor go unnoticed. Closes: #563 --- borg/archiver.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/borg/archiver.py b/borg/archiver.py index 8005d73bc..0bf6f5976 100644 --- a/borg/archiver.py +++ b/borg/archiver.py @@ -862,7 +862,7 @@ class Archiver: subparser.add_argument('--last', dest='last', type=int, default=None, metavar='N', help='only check last N archives (Default: all)') - subparser.add_argument('-p', '--prefix', dest='prefix', type=str, + subparser.add_argument('-P', '--prefix', dest='prefix', type=str, help='only consider archive names starting with this prefix') change_passphrase_epilog = textwrap.dedent(""" @@ -1048,7 +1048,7 @@ class Archiver: subparser.add_argument('--short', dest='short', action='store_true', default=False, help='only print file/directory names, nothing else') - subparser.add_argument('-p', '--prefix', dest='prefix', type=str, + subparser.add_argument('-P', '--prefix', dest='prefix', type=str, help='only consider archive names starting with this prefix') subparser.add_argument('location', metavar='REPOSITORY_OR_ARCHIVE', nargs='?', default='', type=location_validator(), @@ -1120,7 +1120,7 @@ class Archiver: "1m" is taken to mean "31d". The archives kept with this option do not count towards the totals specified by any other options. - If a prefix is set with -p, then only archives that start with the prefix are + If a prefix is set with -P, then only archives that start with the prefix are considered for deletion and only those archives count towards the totals specified by the rules. Otherwise, *all* archives in the repository are candidates for deletion! @@ -1148,7 +1148,7 @@ class Archiver: help='number of monthly archives to keep') subparser.add_argument('-y', '--keep-yearly', dest='yearly', type=int, default=0, help='number of yearly archives to keep') - subparser.add_argument('-p', '--prefix', dest='prefix', type=str, + subparser.add_argument('-P', '--prefix', dest='prefix', type=str, help='only consider archive names starting with this prefix') subparser.add_argument('--save-space', dest='save_space', action='store_true', default=False,