From 5886aa9247f9673ddf3c0530d0bd01f95ea27848 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 29 Oct 2021 19:43:16 -0700 Subject: [PATCH] Use "colordiff" to highlight "beet move" path differences --- beets/ui/__init__.py | 12 +++++++++--- docs/changelog.rst | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 8cf6cbbf6..5e0de77e2 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -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. diff --git a/docs/changelog.rst b/docs/changelog.rst index 72af36e3c..5ce90b624 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -37,6 +37,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: