aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Powers <mark@marks.kitchen>2022-12-31 17:37:55 -0600
committerMark Powers <mark@marks.kitchen>2022-12-31 17:37:55 -0600
commit59254be8150d63f379f94323362f8ee72ea1510c (patch)
treeac211ea6adc82734ac4bf94508998e431b71cb09
parentadf68faa1438212cb745aa07931ca56891af2933 (diff)
Add difflib output on editHEADmaster
-rw-r--r--wikijscmd/commands.py6
1 files changed, 5 insertions, 1 deletions
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"])