[sysadmin-bin] Write JSON to file instead of stdout



commit 2bdecce3ea537c2d962a22dcbecf0620750d9e21
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Mon Sep 6 15:59:37 2021 +0200

    Write JSON to file instead of stdout

 gitlab/inactive-gitlab-users.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gitlab/inactive-gitlab-users.py b/gitlab/inactive-gitlab-users.py
index 8c94cc7..d858d24 100755
--- a/gitlab/inactive-gitlab-users.py
+++ b/gitlab/inactive-gitlab-users.py
@@ -256,7 +256,8 @@ if __name__ == "__main__":
     if args.command == "get-inactive":
         unit, value = args.timedelta.split(":")
         inactive = get_inactive_users(gl, unit, value)
-        print(json.dumps(inactive, indent=4, separators=(",", ": ")))
+        with open("inactive.json", "w") as f:
+            json.dump(inactive, f)
     elif args.command == "trust":
         for id in args.user_id:
             trust_user(gl, id)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]