diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/gos/main.go | 42 |
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) + } +} |
