summaryrefslogtreecommitdiff
path: root/internal/run.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-04 23:11:44 +0300
committerPaul Buetow <paul@buetow.org>2024-10-04 23:11:44 +0300
commitdd959fcfb3a3aa5a01d3d3912b1c976e653b71d8 (patch)
tree31d36f3f736b8401ba4948ae2c5f6f4e80871b82 /internal/run.go
parent8c178c66d575018695d4a036630a140319705066 (diff)
can post to linkedin initially
Diffstat (limited to 'internal/run.go')
-rw-r--r--internal/run.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/run.go b/internal/run.go
index 3beea29..b628d9c 100644
--- a/internal/run.go
+++ b/internal/run.go
@@ -7,6 +7,7 @@ import (
"strings"
"codeberg.org/snonux/gos/internal/config"
+ "codeberg.org/snonux/gos/internal/platforms/linkedin"
"codeberg.org/snonux/gos/internal/platforms/mastodon"
"codeberg.org/snonux/gos/internal/queue"
"codeberg.org/snonux/gos/internal/schedule"
@@ -44,6 +45,18 @@ func Run(ctx context.Context, args config.Args) error {
return err
}
log.Println("Posted", ent, "to", platform)
+ case "linkedin":
+ if args.DryRun {
+ log.Println("Not posting", ent, "to", platform, "as dry-run enabled")
+ continue
+ }
+ if err := linkedin.Post(ctx, args, ent); err != nil {
+ return err
+ }
+ if err := ent.MarkPosted(); err != nil {
+ return err
+ }
+ log.Println("Posted", ent, "to", platform)
default:
// TODO: Once we have LinkedIn implemented, make the above code
// more generic so that it can be used with LinkedIn as well.