diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-09 23:52:54 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-09 23:52:54 +0300 |
| commit | be3abe2462bca511ede21cacd1e5a3690b5aa745 (patch) | |
| tree | 7028dfbd0ffe9f386ff7605ef544470db09cd766 /internal/platforms | |
| parent | af7c12e5d42b6a19fd657138862ca6db6942d402 (diff) | |
refator
Diffstat (limited to 'internal/platforms')
| -rw-r--r-- | internal/platforms/linkedin/linkedin.go | 4 | ||||
| -rw-r--r-- | internal/platforms/mastodon/mastodon.go | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/internal/platforms/linkedin/linkedin.go b/internal/platforms/linkedin/linkedin.go index ce30970..401d5a3 100644 --- a/internal/platforms/linkedin/linkedin.go +++ b/internal/platforms/linkedin/linkedin.go @@ -31,6 +31,10 @@ func Post(ctx context.Context, args config.Args, ent entry.Entry) error { } func post(ctx context.Context, args config.Args, ent entry.Entry) error { + if args.DryRun { + log.Println("Not posting", ent, "to LinkedIn as dry-run enabled") + return nil + } personID, accessToken, err := oauth2.LinkedInCreds(args) if err != err { return err diff --git a/internal/platforms/mastodon/mastodon.go b/internal/platforms/mastodon/mastodon.go index 361d1a5..7cdb513 100644 --- a/internal/platforms/mastodon/mastodon.go +++ b/internal/platforms/mastodon/mastodon.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "log" "net/http" "codeberg.org/snonux/gos/internal/config" @@ -22,6 +23,10 @@ func Post(ctx context.Context, args config.Args, ent entry.Entry) error { if err != nil { return fmt.Errorf("failed to marshal payload: %w", err) } + if args.DryRun { + log.Println("Not posting", ent, "to Mastodon as dry-run enabled") + return nil + } if !prompt.Yes(fmt.Sprintf("%s\nDo you want to post this message to Mastodon?", string(payloadBytes))) { return prompt.ErrAborted } |
