From 7246f4d18aa4f5e161b6e185b02fa28187e04747 Mon Sep 17 00:00:00 2001
From: Yohann D'ANELLO <yohann.danello@gmail.com>
Date: Sat, 5 Sep 2020 00:45:10 +0200
Subject: [PATCH] Change debug option to "print stdout" / "edit wiki" in the
 Refresh activities script

---
 management/commands/refresh_activities.py | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/management/commands/refresh_activities.py b/management/commands/refresh_activities.py
index c92bec0..35b4301 100644
--- a/management/commands/refresh_activities.py
+++ b/management/commands/refresh_activities.py
@@ -150,30 +150,31 @@ class Command(BaseCommand):
         return page, header + body
 
     @staticmethod
-    def refresh_raw_wiki_page(comment="refresh", debug=True):
+    def refresh_raw_wiki_page(comment="refresh", print_stdout=False, edit_wiki=False):
         page, content = Command.get_raw_page()
-        if debug:
+        if print_stdout:
             print(content)
-        else:
+        if edit_wiki:
             Command.edit_wiki(page, content, comment)
 
     @staticmethod
-    def refresh_human_readable_wiki_page(comment="refresh", debug=True):
+    def refresh_human_readable_wiki_page(comment="refresh", print_stdout=False, edit_wiki=False):
         page, content = Command.get_human_readable_page()
-        if debug:
+        if print_stdout:
             print(content)
-        else:
+        if edit_wiki:
             Command.edit_wiki(page, content, comment)
 
     def add_arguments(self, parser):
         parser.add_argument("--human", "-H", action="store_true", help="Save human readable page")
         parser.add_argument("--raw", "-r", action="store_true", help="Save raw page, for the calendar")
         parser.add_argument("--comment", "-c", action="store", type=str, default="", help="Comment of the modification")
-        parser.add_argument("--debug", "-d", action="store_true", help="Don't commit to the wiki, render in stdout")
+        parser.add_argument("--stdout", "-o", action="store_true", help="Render the wiki page in stdout")
+        parser.add_argument("--wiki", "-w", action="store_true", help="Send modifications to the wiki")
 
     def handle(self, *args, **options):
         if options["raw"]:
-            Command.refresh_raw_wiki_page(options["comment"], options["debug"])
+            Command.refresh_raw_wiki_page(options["comment"], options["stdout"], options["wiki"])
         if options["human"]:
-            Command.refresh_human_readable_wiki_page(options["comment"], options["debug"])
+            Command.refresh_human_readable_wiki_page(options["comment"], options["stdout"], options["wiki"])
 
-- 
GitLab