Merge pull request #4129 from tianon/color-move

Use "colordiff" to highlight "beet move" path differences
This commit is contained in:
Benedikt 2021-11-01 18:48:05 +01:00 committed by GitHub
commit bcdf78e0c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -757,15 +757,21 @@ def show_path_changes(path_changes):
if max_width > col_width:
# Print every change over two lines
for source, dest in zip(sources, destinations):
log.info('{0} \n -> {1}', source, dest)
color_source, color_dest = colordiff(source, dest)
print_('{0} \n -> {1}'.format(color_source, color_dest))
else:
# Print every change on a single line, and add a header
title_pad = max_width - len('Source ') + len(' -> ')
log.info('Source {0} Destination', ' ' * title_pad)
print_('Source {0} Destination'.format(' ' * title_pad))
for source, dest in zip(sources, destinations):
pad = max_width - len(source)
log.info('{0} {1} -> {2}', source, ' ' * pad, dest)
color_source, color_dest = colordiff(source, dest)
print_('{0} {1} -> {2}'.format(
color_source,
' ' * pad,
color_dest,
))
# Helper functions for option parsing.

View file

@ -40,6 +40,7 @@ Other new things:
subdirectories in library.
* :doc:`/plugins/info`: Support ``--album`` flag.
* :doc:`/plugins/export`: Support ``--album`` flag.
* ``beet move`` path differences are now highlighted in color (when enabled).
For plugin developers: