From 59254be8150d63f379f94323362f8ee72ea1510c Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sat, 31 Dec 2022 17:37:55 -0600 Subject: Add difflib output on edit --- wikijscmd/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'wikijscmd') diff --git a/wikijscmd/commands.py b/wikijscmd/commands.py index 5a10099..1da0ecd 100644 --- a/wikijscmd/commands.py +++ b/wikijscmd/commands.py @@ -2,6 +2,7 @@ import sys import subprocess import time import os +import difflib from datetime import datetime, timedelta @@ -86,7 +87,10 @@ def edit(path, save=False): # Prompt user to save it to the wiki print_item(page) print("-" * 80) - print(new_body) + print("".join(difflib.unified_diff( + body.splitlines(keepends=True), + new_body.splitlines(keepends=True) + ))) print("-" * 80) if save or input("Save changes? (y/n) ") == "y": response = graphql_queries.edit_page(page["id"], new_body, page["title"], page["path"]) -- cgit v1.2.3