From b5bb6f8480b163b1786bcbb805c94f3fe55c2b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian-Samuel=20Geb=C3=BChr?= Date: Thu, 13 Jul 2023 11:33:55 +0200 Subject: [PATCH] Show nicer diff when merging --- mastodon_blocklist_deploy/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mastodon_blocklist_deploy/cli.py b/mastodon_blocklist_deploy/cli.py index 6c87248..c0e9053 100644 --- a/mastodon_blocklist_deploy/cli.py +++ b/mastodon_blocklist_deploy/cli.py @@ -65,6 +65,9 @@ def exporter(blocklist, output=None, format: str = "toml", private: bool = False def merge(input_file, merge_target, format: str = "toml", private: bool = False, overwrite=False): + """Shows a table in the CLI comparing the local and remote blocklist""" + from rich.table import Table + from rich.console import Console input_blocklist = load_blocklist_file(input_file) merge_target_blocklist = load_blocklist_file(merge_target) for input_instance in input_blocklist: @@ -78,7 +81,7 @@ def merge(input_file, merge_target, format: str = "toml", private: bool = False, key_input = "" while key_input not in ("i", "O"): print(f"Different settings for {input_instance.domain} detected.") - print(f"In the input blocklist the setting is\n{input_instance} whereas it's {merge_target_instance} in the merge target") + Instance.show_diff(input_instance, merge_target_instance) key_input = input("Keep input (i) or original (o) [i/O]") elif key_input == "i": merge_target_blocklist.append(merge_target_instance)