]> git.mar77i.info Git - admin/commitdiff
clean up code, add ga-cli
authormar77i <mar77i@protonmail.ch>
Mon, 20 May 2024 15:40:34 +0000 (17:40 +0200)
committermar77i <mar77i@protonmail.ch>
Mon, 20 May 2024 15:40:34 +0000 (17:40 +0200)
gitweb_configs.py

index 514d8236b4c266ab5603bb611a23e0910d4065df..660b6c2c7d5c487d6aa47a34cc054227de0b2841 100755 (executable)
@@ -7,30 +7,13 @@ from shutil import rmtree
 from subprocess import CalledProcessError, check_output, run
 
 GITWEB_CONFIGS = {
-    "admin": {
-        "owner": "mar77i <mar77i@protonmail.ch>",
-        "description": "admin scripts",
-    },
-    "mar77i.info": {
-        "owner": "mar77i <mar77i@protonmail.ch>",
-        "description": "mar77i.info website",
-    },
-    "hublib": {
-        "owner": "mar77i <mar77i@protonmail.ch>",
-        "description": "base for websocket toys",
-    },
-    "laptop-config": {
-        "owner": "mar77i <mar77i@protonmail.ch>",
-        "description": "laptop screen configuration",
-    },
-    "rcfiles": {
-        "owner": "mar77i <mar77i@protonmail.ch>",
-        "description": "user configuration files",
-    },
-    "bigintmandel": {
-        "owner": "mar77i <mar77i@protonmail.ch>",
-        "description": "Qt mandelbrot toy, with big integers only",
-    },
+    "admin": "admin scripts",
+    "mar77i.info": "mar77i.info website",
+    "hublib": "base for websocket toys",
+    "laptop-config": "laptop screen configuration",
+    "rcfiles": "user configuration files",
+    "bigintmandel": "Qt mandelbrot toy, with big integers only",
+    "ga-cli": "Google authenticator for CLI",
 }
 
 
@@ -40,7 +23,7 @@ def main():
         if p.is_dir() and p.name not in GITWEB_CONFIGS:
             rmtree(p)
             print(f"removed {p.name}")
-    for repository, configs in GITWEB_CONFIGS.items():
+    for repository, description in GITWEB_CONFIGS.items():
         p = base_dir / repository
         if not p.exists():
             p.mkdir(0o755)
@@ -49,14 +32,18 @@ def main():
             print(f"created {p.name}")
         else:
             os.chdir(p)
-        description = p / "description"
-        if description.exists():
-            description.unlink()
-        assert set(configs) == {"owner", "description"}
+        description_path = p / "description"
+        if description_path.exists():
+            description_path.unlink()
+        configs = {
+            "owner": "mar77i <mar77i@protonmail.ch>",
+            "description": description,
+        }
         for key, value in configs.items():
             try:
                 output = check_output(
-                    ["git", "config", "--get", f"gitweb.{key}"], universal_newlines=True
+                    ["git", "config", "--get", f"gitweb.{key}"],
+                    universal_newlines=True,
                 )
             except CalledProcessError:
                 output = None