make clean

This commit is contained in:
2026-03-04 22:28:37 +01:00
parent 89dc3afa12
commit 08463e18d0
2 changed files with 27 additions and 4 deletions

View File

@@ -311,6 +311,20 @@ class BlogWriter:
print(f"✓ Successfully uploaded to {self.wiki.base_domain}/{page_path}")
def clean(self):
"""Delete all .md files in the output directory."""
if not os.path.exists(OUTPUT_DIR):
print(f"→ Output directory '{OUTPUT_DIR}' does not exist. Nothing to clean.")
return
print(f"→ Cleaning {OUTPUT_DIR}/...")
count = 0
for filename in os.listdir(OUTPUT_DIR):
if filename.endswith(".md"):
os.remove(os.path.join(OUTPUT_DIR, filename))
count += 1
print(f"✓ Removed {count} Markdown files.")
# ---------------------------------------------------------------------------
# Entry point
@@ -329,13 +343,16 @@ def main():
p_fetch.add_argument("url", help="Page path or full URL, e.g. /my-page or https://wiki.example.com/my-page")
# write
subparsers.add_parser("write", help=f"Generate blog post from {SOURCE_FILE} using Gemini")
subparsers.add_parser("write", help=f"Generate blog post using Gemini")
# translate
subparsers.add_parser("translate", help=f"Translate {BLOGPOST_FILE} using Gemini")
subparsers.add_parser("translate", help=f"Translate generated blog post using Gemini")
# upload
subparsers.add_parser("upload", help=f"Upload {TRANSLATED_FILE} to Wiki.js")
subparsers.add_parser("upload", help=f"Upload translated blog post to Wiki.js")
# clean
subparsers.add_parser("clean", help=f"Delete all .md files in the {OUTPUT_DIR} directory")
args = parser.parse_args()
writer = BlogWriter()
@@ -348,6 +365,8 @@ def main():
writer.translate()
elif args.command == "upload":
writer.upload()
elif args.command == "clean":
writer.clean()
if __name__ == "__main__":