Show nicer diff when merging
This commit is contained in:
parent
d47a63e331
commit
b5bb6f8480
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user