From fc274b43f0f18a75d2664da67b052458f79d886d Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 22 Oct 2019 22:42:36 -0700 Subject: [PATCH] Rename "borgmatic list --pattern-from" flag to "--patterns-from" to match Borg (#230). --- NEWS | 1 + borgmatic/borg/create.py | 4 ++-- borgmatic/commands/arguments.py | 2 +- tests/unit/borg/test_list.py | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index d618cdbd..2dd7107b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ 1.3.27.dev0 * #225: Database dump hooks for PostgreSQL, so you can easily dump your databases before backups run. + * #230: Rename "borgmatic list --pattern-from" flag to "--patterns-from" to match Borg. 1.3.26 * #224: Fix "borgmatic list --successful" with a slightly better heuristic for listing successful diff --git a/borgmatic/borg/create.py b/borgmatic/borg/create.py index 783c428a..86cf9532 100644 --- a/borgmatic/borg/create.py +++ b/borgmatic/borg/create.py @@ -60,8 +60,8 @@ def _write_pattern_file(patterns=None): def _make_pattern_flags(location_config, pattern_filename=None): ''' - Given a location config dict with a potential pattern_from option, and a filename containing any - additional patterns, return the corresponding Borg flags for those files as a tuple. + Given a location config dict with a potential patterns_from option, and a filename containing + any additional patterns, return the corresponding Borg flags for those files as a tuple. ''' pattern_filenames = tuple(location_config.get('patterns_from') or ()) + ( (pattern_filename,) if pattern_filename else () diff --git a/borgmatic/commands/arguments.py b/borgmatic/commands/arguments.py index aa5bd392..db92bdcc 100644 --- a/borgmatic/commands/arguments.py +++ b/borgmatic/commands/arguments.py @@ -339,7 +339,7 @@ def parse_arguments(*unparsed_arguments): ) list_group.add_argument('--pattern', help='Include or exclude paths matching a pattern') list_group.add_argument( - '--pattern-from', + '--patterns-from', metavar='FILENAME', help='Include or exclude paths matching patterns from pattern file, one per line', ) diff --git a/tests/unit/borg/test_list.py b/tests/unit/borg/test_list.py index c0a74616..2b84d0e4 100644 --- a/tests/unit/borg/test_list.py +++ b/tests/unit/borg/test_list.py @@ -147,7 +147,7 @@ def test_list_archives_with_short_calls_borg_with_short_parameter(): 'exclude', 'exclude_from', 'pattern', - 'pattern_from', + 'patterns_from', ), ) def test_list_archives_passes_through_arguments_to_borg(argument_name):