summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-09-21 15:54:11 +0300
committerPaul Buetow <paul@buetow.org>2024-09-21 15:54:11 +0300
commitd38f93fc4fdb54687c425b8866bc99cbd9ad7935 (patch)
treeca5e5b3c582ea373aa6b9193d2e047e2fb06c2f5 /cmd
parentdff4d455e07d639b82a0bed814f41d0656e9b6d0 (diff)
initial revamp
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gos/main.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/cmd/gos/main.go b/cmd/gos/main.go
new file mode 100644
index 0000000..67f3351
--- /dev/null
+++ b/cmd/gos/main.go
@@ -0,0 +1,42 @@
+package main
+
+import (
+ "context"
+ "flag"
+ "fmt"
+ "log"
+ "strings"
+ "time"
+
+ "codeberg.org/snonux/gos/internal"
+ "codeberg.org/snonux/gos/internal/config"
+)
+
+const versionStr = "v0.0.0"
+
+func main() {
+ dry := flag.Bool("dry", false, "Dry run")
+ version := flag.Bool("version", false, "Display version")
+ gosDir := flag.String("gosDir", "./gosdir", "Gos' directory")
+ platforms := flag.String("platforms", "Mastodon,LinkedIn", "Platforms enabled")
+ flag.Parse()
+
+ args := config.Args{
+ DryRun: *dry,
+ GosDir: *gosDir,
+ Platforms: strings.Split(*platforms, ","),
+ }
+
+ if *version {
+ fmt.Printf("This is Gos version %s; (C) by Paul Buetow\n", versionStr)
+ fmt.Println("https://codeberg.org/snonux/gos")
+ return
+ }
+
+ ctx, cancel := context.WithTimeout(context.Background(), time.Duration(1*time.Minute))
+ defer cancel()
+
+ if err := internal.Run(ctx, args); err != nil {
+ log.Fatal(err)
+ }
+}