diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-31 22:07:56 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-31 22:07:56 +0200 |
| commit | 368d58e61ab3f9978c7cf51ee4c0d45263b9e5c5 (patch) | |
| tree | 86c39f05f4d9d071ff3d9266599f96e37aff8c8e /internal/platforms | |
| parent | e45b591404ebb36fa7d71510e99fdecf668a85e7 (diff) | |
refactor
Diffstat (limited to 'internal/platforms')
| -rw-r--r-- | internal/platforms/linkedin/linkedin.go | 8 | ||||
| -rw-r--r-- | internal/platforms/mastodon/mastodon.go | 9 |
2 files changed, 2 insertions, 15 deletions
diff --git a/internal/platforms/linkedin/linkedin.go b/internal/platforms/linkedin/linkedin.go index 75f4693..0c5de92 100644 --- a/internal/platforms/linkedin/linkedin.go +++ b/internal/platforms/linkedin/linkedin.go @@ -59,13 +59,7 @@ func post(ctx context.Context, args config.Args, sizeLimit int, ent entry.Entry) } question := fmt.Sprintf("Do you want to post this message to Linkedin (%v)?", prev) - if err := prompt.DoYouWantThis(question, content); err != nil { - if errors.Is(err, prompt.ErrEditContent) { - if err := ent.Edit(); err != nil { - return err - } - return post(ctx, args, sizeLimit, ent) - } + if err := prompt.FileAction(question, content, ent.Path); err != nil { return err } diff --git a/internal/platforms/mastodon/mastodon.go b/internal/platforms/mastodon/mastodon.go index f896290..919d39d 100644 --- a/internal/platforms/mastodon/mastodon.go +++ b/internal/platforms/mastodon/mastodon.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "io" "log" @@ -32,13 +31,7 @@ func Post(ctx context.Context, args config.Args, sizeLimit int, ent entry.Entry) log.Println("Not posting", ent, "to Mastodon as dry-run enabled") return nil } - if err := prompt.DoYouWantThis("Do you want to post this message to Mastodon?", content); err != nil { - if errors.Is(err, prompt.ErrEditContent) { - if err := ent.Edit(); err != nil { - return err - } - return Post(ctx, args, sizeLimit, ent) - } + if err := prompt.FileAction("Do you want to post this message to Mastodon?", content, ent.Path); err != nil { return err } |
