diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-17 10:38:40 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-17 10:38:40 +0300 |
| commit | 563ea5dbaaa77e59939812d6825d54cf829db8eb (patch) | |
| tree | 1518d99868e86357f4ae81c0946f209adad4d8c1 /internal/run.go | |
| parent | a66b2114ee9fb9078d6f3c12566d7178e0662903 (diff) | |
implement sizeLimit per platform
Diffstat (limited to 'internal/run.go')
| -rw-r--r-- | internal/run.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/run.go b/internal/run.go index acf0525..ed70511 100644 --- a/internal/run.go +++ b/internal/run.go @@ -20,8 +20,8 @@ func Run(ctx context.Context, args config.Args) error { return err } - for _, platform := range args.Platforms { - if err := runPlatform(ctx, args, platform); err != nil { + for platform, sizeLimit := range args.Platforms { + if err := runPlatform(ctx, args, platform, sizeLimit); err != nil { if errors.Is(err, prompt.ErrAborted) { log.Println("Aborted posting to", platform) continue @@ -33,7 +33,7 @@ func Run(ctx context.Context, args config.Args) error { return nil } -func runPlatform(ctx context.Context, args config.Args, platform string) error { +func runPlatform(ctx context.Context, args config.Args, platform string, sizeLimit int) error { ent, err := schedule.Run(args, platform) switch { case errors.Is(err, schedule.ErrNothingToSchedule): @@ -47,7 +47,7 @@ func runPlatform(ctx context.Context, args config.Args, platform string) error { } log.Println("Scheduling", ent) - var postCB func(context.Context, config.Args, entry.Entry) error + var postCB func(context.Context, config.Args, int, entry.Entry) error switch strings.ToLower(platform) { case "mastodon": postCB = mastodon.Post @@ -57,7 +57,7 @@ func runPlatform(ctx context.Context, args config.Args, platform string) error { log.Fatal("Platform", platform, "(not yet) implemented") } - if err := postCB(ctx, args, ent); err != nil { + if err := postCB(ctx, args, sizeLimit, ent); err != nil { return err } |
