diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ae3011..3ea0963 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,10 @@ ## [0.9.2] - Unreleased ### Added -- add `symlink-smaller` action +- `symlink-smaller` action to replace the smaller files of a group with a symlink to the biggest one + +### Changed +- `delete-smaller` and `delete-bigger` actions to `delete-smallest` and `delete-biggest` ## [0.9.1] - 2023-08-23 diff --git a/README.md b/README.md index 8e831fd..577bcc2 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,9 @@ Use the `--on-equal` option to select what to do to pairs of equal images. The d `print`. - `delete-first` or `d1`: deletes the first of the files in the group - `delete-last` or `dl`: deletes the last of the files in the group -- `delete-bigger` or `d>`: deletes the file with the biggest size -- `delete-smaller` or `d<`: deletes the file with the smallest size +- `delete-biggest` or `d>`: deletes the file with the biggest size +- `delete-smallest` or `d<`: deletes the file with the smallest size +- `symlink-smaller`: delete the smaller files and replace them to a symlink to the biggest file - `eog`: launches the `eog` image viewer to compare the files in the group (*deprecated* by `exec`) - `xv`: launches the `xv` image viewer to compare the files in the group (*deprecated* by `exec`) - `print`: prints the files in the group diff --git a/duplicate_images/methods.py b/duplicate_images/methods.py index e18d36f..601dc1c 100644 --- a/duplicate_images/methods.py +++ b/duplicate_images/methods.py @@ -75,9 +75,9 @@ def get_hash_size_kwargs(algorithm: HashFunction, size: Optional[int]) -> Dict[s 'd1': lambda args, group: delete_with_log_message(group[0]), 'delete-last': lambda args, group: delete_with_log_message(group[-1]), 'dl': lambda args, group: delete_with_log_message(group[-1]), - 'delete-bigger': lambda args, group: delete_with_log_message(ascending_by_size(group)[-1]), + 'delete-biggest': lambda args, group: delete_with_log_message(ascending_by_size(group)[-1]), 'd>': lambda args, group: delete_with_log_message(ascending_by_size(group)[-1]), - 'delete-smaller': lambda args, group: delete_with_log_message(ascending_by_size(group)[0]), + 'delete-smallest': lambda args, group: delete_with_log_message(ascending_by_size(group)[0]), 'd<': lambda args, group: delete_with_log_message(ascending_by_size(group)[0]), 'symlink-smaller': lambda args, group: symlink_to_biggest_file(group), 'eog': lambda args, group: call(['eog'] + [str(pic) for pic in group]), # nosec diff --git a/tests/unit/test_actions.py b/tests/unit/test_actions.py index 3f8747d..d432ee9 100644 --- a/tests/unit/test_actions.py +++ b/tests/unit/test_actions.py @@ -80,17 +80,17 @@ def test_delete_last(equal_images: List[Path], option: str, group: bool) -> None check_relevant_is_deleted_and_others_are_present(equals, option, relevant) -@pytest.mark.parametrize('option', ['delete-bigger', 'd>']) +@pytest.mark.parametrize('option', ['delete-biggest', 'd>']) @pytest.mark.parametrize('group', [True, False]) -def test_delete_bigger(equal_images: List[Path], option: str, group: bool) -> None: +def test_delete_biggest(equal_images: List[Path], option: str, group: bool) -> None: equals = get_equals(equal_images, group) relevant = get_biggest(equals) check_relevant_is_deleted_and_others_are_present(equals, option, relevant) -@pytest.mark.parametrize('option', ['delete-smaller', 'd<']) +@pytest.mark.parametrize('option', ['delete-smallest', 'd<']) @pytest.mark.parametrize('group', [True, False]) -def test_delete_smaller(equal_images: List[Path], option: str, group: bool) -> None: +def test_delete_smallest(equal_images: List[Path], option: str, group: bool) -> None: equals = get_equals(equal_images, group) relevant = get_smallest(equals) check_relevant_is_deleted_and_others_are_present(equals, option, relevant)