Added TIMESPAN flags to match archive in various commands (Borg2 feature)
Signed-off-by: jetchirag <thechiragaggarwal@gmail.com>
This commit is contained in:
parent
ca6fd6b061
commit
141474ff07
5 changed files with 82 additions and 0 deletions
|
@ -35,6 +35,7 @@ def run_mount(
|
|||
mount_arguments.paths,
|
||||
mount_arguments.foreground,
|
||||
mount_arguments.options,
|
||||
mount_arguments,
|
||||
storage,
|
||||
local_borg_version,
|
||||
local_path=local_path,
|
||||
|
|
|
@ -44,6 +44,7 @@ def run_prune(
|
|||
storage,
|
||||
retention,
|
||||
local_borg_version,
|
||||
prune_arguments,
|
||||
local_path=local_path,
|
||||
remote_path=remote_path,
|
||||
stats=prune_arguments.stats,
|
||||
|
|
|
@ -13,6 +13,7 @@ def mount_archive(
|
|||
paths,
|
||||
foreground,
|
||||
options,
|
||||
mount_arguments,
|
||||
storage_config,
|
||||
local_borg_version,
|
||||
local_path='borg',
|
||||
|
@ -35,6 +36,12 @@ def mount_archive(
|
|||
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
|
||||
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
|
||||
+ (('--foreground',) if foreground else ())
|
||||
+ (flags.make_flags('first', mount_arguments.first) if mount_arguments.first else ())
|
||||
+ (flags.make_flags('last', mount_arguments.last) if mount_arguments.last else ())
|
||||
+ (flags.make_flags('newest', mount_arguments.newest) if mount_arguments.newest else ())
|
||||
+ (flags.make_flags('oldest', mount_arguments.oldest) if mount_arguments.oldest else ())
|
||||
+ (flags.make_flags('older', mount_arguments.older) if mount_arguments.older else ())
|
||||
+ (flags.make_flags('newer', mount_arguments.newer) if mount_arguments.newer else ())
|
||||
+ (('-o', options) if options else ())
|
||||
+ (
|
||||
(
|
||||
|
|
|
@ -43,6 +43,7 @@ def prune_archives(
|
|||
storage_config,
|
||||
retention_config,
|
||||
local_borg_version,
|
||||
prune_arguments,
|
||||
local_path='borg',
|
||||
remote_path=None,
|
||||
stats=False,
|
||||
|
@ -71,6 +72,10 @@ def prune_archives(
|
|||
+ (('--stats',) if stats and not dry_run else ())
|
||||
+ (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
|
||||
+ (('--list',) if list_archives else ())
|
||||
+ (flags.make_flags('newest', prune_arguments.newest) if prune_arguments.newest else ())
|
||||
+ (flags.make_flags('oldest', prune_arguments.oldest) if prune_arguments.oldest else ())
|
||||
+ (flags.make_flags('older', prune_arguments.older) if prune_arguments.older else ())
|
||||
+ (flags.make_flags('newer', prune_arguments.newer) if prune_arguments.newer else ())
|
||||
+ (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
|
||||
+ (('--dry-run',) if dry_run else ())
|
||||
+ (tuple(extra_borg_options.split(' ')) if extra_borg_options else ())
|
||||
|
|
|
@ -321,6 +321,18 @@ def make_parsers():
|
|||
transfer_group.add_argument(
|
||||
'--last', metavar='N', help='Only transfer last N archives after other filters are applied'
|
||||
)
|
||||
transfer_group.add_argument(
|
||||
'--oldest', metavar='TIMESPAN', help='Transfer archives within a specified time range starting from the timestamp of the oldest archive (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
transfer_group.add_argument(
|
||||
'--newest', metavar='TIMESPAN', help='Transfer archives within a time range that ends at newest archive\'s timestamp and starts a specified time range ago (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
transfer_group.add_argument(
|
||||
'--older', metavar='TIMESPAN', help='Transfer archives that are older than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
transfer_group.add_argument(
|
||||
'--newer', metavar='TIMESPAN', help='Transfer archives that are newer than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
transfer_group.add_argument(
|
||||
'-h', '--help', action='help', help='Show this help message and exit'
|
||||
)
|
||||
|
@ -347,6 +359,18 @@ def make_parsers():
|
|||
prune_group.add_argument(
|
||||
'--list', dest='list_archives', action='store_true', help='List archives kept/pruned'
|
||||
)
|
||||
prune_group.add_argument(
|
||||
'--oldest', metavar='TIMESPAN', help='Consider archives within a specified time range starting from the timestamp of the oldest archive (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
prune_group.add_argument(
|
||||
'--newest', metavar='TIMESPAN', help='Consider archives within a time range that ends at newest archive\'s timestamp and starts a specified time range ago (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
prune_group.add_argument(
|
||||
'--older', metavar='TIMESPAN', help='Consider archives that are older than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
prune_group.add_argument(
|
||||
'--newer', metavar='TIMESPAN', help='Consider archives that are newer than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
prune_group.add_argument('-h', '--help', action='help', help='Show this help message and exit')
|
||||
|
||||
compact_parser = subparsers.add_parser(
|
||||
|
@ -587,6 +611,26 @@ def make_parsers():
|
|||
action='store_true',
|
||||
help='Stay in foreground until ctrl-C is pressed',
|
||||
)
|
||||
mount_group.add_argument(
|
||||
'--first',
|
||||
metavar='N',
|
||||
help='Mount first N archives after other filters are applied',
|
||||
)
|
||||
mount_group.add_argument(
|
||||
'--last', metavar='N', help='Mount last N archives after other filters are applied'
|
||||
)
|
||||
mount_group.add_argument(
|
||||
'--oldest', metavar='TIMESPAN', help='Mount archives within a specified time range starting from the timestamp of the oldest archive (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
mount_group.add_argument(
|
||||
'--newest', metavar='TIMESPAN', help='Mount archives within a time range that ends at newest archive\'s timestamp and starts a specified time range ago (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
mount_group.add_argument(
|
||||
'--older', metavar='TIMESPAN', help='Mount archives that are older than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
mount_group.add_argument(
|
||||
'--newer', metavar='TIMESPAN', help='Mount archives that are newer than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
mount_group.add_argument('--options', dest='options', help='Extra Borg mount options')
|
||||
mount_group.add_argument('-h', '--help', action='help', help='Show this help message and exit')
|
||||
|
||||
|
@ -670,6 +714,18 @@ def make_parsers():
|
|||
rlist_group.add_argument(
|
||||
'--last', metavar='N', help='List last N archives after other filters are applied'
|
||||
)
|
||||
rlist_group.add_argument(
|
||||
'--oldest', metavar='TIMESPAN', help='List archives within a specified time range starting from the timestamp of the oldest archive (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
rlist_group.add_argument(
|
||||
'--newest', metavar='TIMESPAN', help='List archives within a time range that ends at newest archive\'s timestamp and starts a specified time range ago (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
rlist_group.add_argument(
|
||||
'--older', metavar='TIMESPAN', help='List archives that are older than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
rlist_group.add_argument(
|
||||
'--newer', metavar='TIMESPAN', help='List archives that are newer than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
rlist_group.add_argument('-h', '--help', action='help', help='Show this help message and exit')
|
||||
|
||||
list_parser = subparsers.add_parser(
|
||||
|
@ -799,6 +855,18 @@ def make_parsers():
|
|||
info_group.add_argument(
|
||||
'--last', metavar='N', help='Show info for last N archives after other filters are applied'
|
||||
)
|
||||
info_group.add_argument(
|
||||
'--oldest', metavar='TIMESPAN', help='Show info for archives within a specified time range starting from the timestamp of the oldest archive (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
info_group.add_argument(
|
||||
'--newest', metavar='TIMESPAN', help='Show info for archives within a time range that ends at newest archive\'s timestamp and starts a specified time range ago (e.g. 7d or 12m) [Borg 2.x+ only]'
|
||||
)
|
||||
info_group.add_argument(
|
||||
'--older', metavar='TIMESPAN', help='Show info for archives that are older than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
info_group.add_argument(
|
||||
'--newer', metavar='TIMESPAN', help='Show info for archives that are newer than the specified time range (e.g. 7d or 12m) from the current time [Borg 2.x+ only]'
|
||||
)
|
||||
info_group.add_argument('-h', '--help', action='help', help='Show this help message and exit')
|
||||
|
||||
break_lock_parser = subparsers.add_parser(
|
||||
|
|
Loading…
Reference in a new issue