Skip to content

Commit

Permalink
rename delete-smaller and delete-bigger actions to `delete-smalle…
Browse files Browse the repository at this point in the history
…st` and `delete-biggest`
  • Loading branch information
lene committed Aug 25, 2023
1 parent 16f3594 commit 5c21b8d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions duplicate_images/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5c21b8d

Please sign in to comment.