diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-09 23:28:21 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-09 23:28:21 +0300 |
| commit | 8e23c12025fac69c6c08aa37e690ee24978c6eed (patch) | |
| tree | a1b5aaba1c73169b1fd1c4d38a639881ded9e15a /internal/platforms/mastodon | |
| parent | a69e38e109f44b85ac068acabe639f48939f1525 (diff) | |
can abort
Diffstat (limited to 'internal/platforms/mastodon')
| -rw-r--r-- | internal/platforms/mastodon/mastodon.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/platforms/mastodon/mastodon.go b/internal/platforms/mastodon/mastodon.go index a933ea6..361d1a5 100644 --- a/internal/platforms/mastodon/mastodon.go +++ b/internal/platforms/mastodon/mastodon.go @@ -9,6 +9,7 @@ import ( "codeberg.org/snonux/gos/internal/config" "codeberg.org/snonux/gos/internal/entry" + "codeberg.org/snonux/gos/internal/prompt" ) func Post(ctx context.Context, args config.Args, ent entry.Entry) error { @@ -21,6 +22,9 @@ 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 !prompt.Yes(fmt.Sprintf("%s\nDo you want to post this message to Mastodon?", string(payloadBytes))) { + return prompt.ErrAborted + } req, err := http.NewRequest("POST", args.Secrets.MastodonURL, bytes.NewBuffer(payloadBytes)) if err != nil { |
