From 97dfc1f21fd8d175bed3232b79cac1434713b05a Mon Sep 17 00:00:00 2001 From: anbosuki Date: Mon, 4 Jul 2022 19:22:35 +0200 Subject: [PATCH] cli-delete-posts Added the possibility to delete single posts or a range of multiple posts at once using the command as following:
`docker-compose run server ./szuru-admin --delete posts 35 36 40-45`
Each space represents a single post id, using a `-` between two ids will delete all posts within range, including the first and the last one --- server/szuru-admin | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/szuru-admin b/server/szuru-admin index dd0279e7..2c479474 100755 --- a/server/szuru-admin +++ b/server/szuru-admin @@ -119,6 +119,9 @@ def delete_posts(parameters: list) -> None: snapshots.delete(post, None) def delete_multiple_posts(start_id: int, end_id: int) -> None: + if start_id > end_id: + start_id, end_id = end_id, start_id + for post_id in range(start_id, end_id + 1): delete_one_post(post_id)