From d38f93fc4fdb54687c425b8866bc99cbd9ad7935 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Sep 2024 15:54:11 +0300 Subject: initial revamp --- cmd/gos/main.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 cmd/gos/main.go (limited to 'cmd') 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) + } +} -- cgit v1.2.3