diff options
| author | Paul Buetow <paul@buetow.org> | 2024-11-03 11:51:50 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-11-03 11:51:50 +0200 |
| commit | 355794f0b55ac7e6ea81efbefa438fd176ea0de6 (patch) | |
| tree | f4c8c04be14cc83477603901bbbc1bbcbf5cd605 /cmd | |
| parent | acb0d5e00c0b19e149eef429881b998414555a5d (diff) | |
move platform parsing to args
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/gos/main.go | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/cmd/gos/main.go b/cmd/gos/main.go index 060e39f..55a9312 100644 --- a/cmd/gos/main.go +++ b/cmd/gos/main.go @@ -7,8 +7,6 @@ import ( "log" "os" "path/filepath" - "strconv" - "strings" "time" "codeberg.org/snonux/gos/internal" @@ -48,23 +46,10 @@ func main() { Secrets: secrets, OAuth2Browser: *browser, } - for _, platform := range strings.Split(*platforms, ",") { - // TODO: Move parsing to config package. - // E.g. Mastodon:500 - parts := strings.Split(platform, ":") - var err error - // E.g. args.Platform["mastodon"] = 500 - if len(parts) > 1 { - args.Platforms[parts[0]], err = strconv.Atoi(parts[1]) - if err != nil { - log.Fatalln(err) - } - } else { - log.Println("No message length specified for", platform, "so assuming 500") - args.Platforms[parts[0]] = 500 - } - } + if err := args.ParsePlatforms(*platforms); err != nil { + log.Fatal(err) + } if err := args.Validate(); err != nil { log.Fatal(err) } |
