summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-17 10:38:40 +0300
committerPaul Buetow <paul@buetow.org>2024-10-17 10:38:40 +0300
commit563ea5dbaaa77e59939812d6825d54cf829db8eb (patch)
tree1518d99868e86357f4ae81c0946f209adad4d8c1 /cmd
parenta66b2114ee9fb9078d6f3c12566d7178e0662903 (diff)
implement sizeLimit per platform
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gos/main.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/cmd/gos/main.go b/cmd/gos/main.go
index 6ea4995..3a4a676 100644
--- a/cmd/gos/main.go
+++ b/cmd/gos/main.go
@@ -7,6 +7,7 @@ import (
"log"
"os"
"path/filepath"
+ "strconv"
"strings"
"time"
@@ -23,7 +24,7 @@ func main() {
browser := flag.String("browser", "firefox", "OAuth2 browser")
secretsConfigPath := filepath.Join(os.Getenv("HOME"), ".config/gos/gosec.json")
secretsConfigPath = *flag.String("secretsConfig", secretsConfigPath, "Gos' secret config")
- platforms := flag.String("platforms", "Mastodon,LinkedIn", "Platforms enabled")
+ platforms := flag.String("platforms", "Mastodon:500,LinkedIn:1000", "Platforms enabled plus their post size limits")
target := flag.Int("target", 2, "How many posts per week are the target?")
lookback := flag.Int("lookback", 30, "How many days look back in time for posting history")
flag.Parse()
@@ -36,13 +37,23 @@ func main() {
args := config.Args{
DryRun: *dry,
GosDir: *gosDir,
- Platforms: strings.Split(*platforms, ","),
+ Platforms: make(map[string]int),
Target: *target,
Lookback: time.Duration(*lookback) * time.Hour * 24,
SecretsConfigPath: secretsConfigPath,
Secrets: secrets,
OAuth2Browser: *browser,
}
+ for _, platform := range strings.Split(*platforms, ",") {
+ // E.g. Mastodon:500
+ parts := strings.Split(platform, ":")
+ var err error
+ // E.g. args.Platform["mastodon"] = 500
+ args.Platforms[parts[0]], err = strconv.Atoi(parts[1])
+ if err != nil {
+ log.Fatalln(err)
+ }
+ }
if err := args.Validate(); err != nil {
log.Fatal(err)