diff options
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 } |
