summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherkulessi <git@herkulessi.de>2026-07-19 14:34:52 +0200
committerherkulessi <git@herkulessi.de>2026-07-19 14:34:52 +0200
commit350dd210f2acd62fb36d728f1cd3cdf894afd704 (patch)
treead21725100b79e2d9dcfe8a1eb4bd1ec17dc15b0
parent285fd559f94584a855d949438a83c8729ef836c7 (diff)
add commands for manipulating the "database"prod
-rw-r--r--main.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/main.go b/main.go
index eaba20e..9f62b38 100644
--- a/main.go
+++ b/main.go
@@ -3,6 +3,7 @@ package main
import (
_ "embed"
"encoding/gob"
+ "fmt"
"io"
"log/slog"
"net/http"
@@ -57,6 +58,25 @@ func main() {
dec.Decode(&migrated)
}
+ if len(os.Args) > 1 {
+ switch os.Args[1] {
+ case "migrate":
+ migrated[os.Args[2]] = struct{}{}
+ save()
+ case "unmigrate":
+ delete(migrated, os.Args[2])
+ save()
+ case "list":
+ for k := range migrated {
+ fmt.Println(k)
+ }
+ default:
+ fmt.Println("Usage:")
+ fmt.Printf("\t%s <[migrate|unmigrate|list] [padid]>", os.Args[0])
+ }
+ os.Exit(0)
+ }
+
http.HandleFunc("GET /p/{id}", func(w http.ResponseWriter, r *http.Request) {
id := r.PathValue("id")