diff options
| author | Paul Buetow <paul@buetow.org> | 2024-11-13 22:53:18 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-11-13 22:53:18 +0200 |
| commit | 905e733a3aec46ff89358b49456da78199a8ed7d (patch) | |
| tree | be75275d0b307cb1d1b6e3b5e05e5f09c4d1d186 | |
| parent | e0796a8f38c512ca1fb1f71aa455aebe1bf88f3a (diff) | |
some
| -rw-r--r-- | internal/entry/entry.go | 3 | ||||
| -rw-r--r-- | internal/platforms/linkedin/linkedin.go | 2 | ||||
| -rw-r--r-- | internal/platforms/mastodon/mastodon.go | 2 | ||||
| -rw-r--r-- | internal/prompt/file.go | 5 |
4 files changed, 10 insertions, 2 deletions
diff --git a/internal/entry/entry.go b/internal/entry/entry.go index 15793a2..1237c3e 100644 --- a/internal/entry/entry.go +++ b/internal/entry/entry.go @@ -178,7 +178,8 @@ func (en Entry) FileAction(question string) error { if err != nil { return err } - return prompt.FileAction(question, content, en.Path) + _, err = prompt.FileAction(question, content, en.Path) + return err } func (en Entry) extractTags(parts []string) { diff --git a/internal/platforms/linkedin/linkedin.go b/internal/platforms/linkedin/linkedin.go index 7db0e0d..9ca929b 100644 --- a/internal/platforms/linkedin/linkedin.go +++ b/internal/platforms/linkedin/linkedin.go @@ -57,6 +57,8 @@ func post(ctx context.Context, args config.Args, sizeLimit int, en entry.Entry) return err } + // TODO: Refactor this. Make it so that in a loop we can also check for the content with limit. + // Maybe pass an interface en.ContentWithLimit and en.Path() to prompt.FileAction question := fmt.Sprintf("Do you want to post this message to Linkedin (%v)?", prev) if content, err = prompt.FileAction(question, content, en.Path); err != nil { return err diff --git a/internal/platforms/mastodon/mastodon.go b/internal/platforms/mastodon/mastodon.go index 186623a..e639b47 100644 --- a/internal/platforms/mastodon/mastodon.go +++ b/internal/platforms/mastodon/mastodon.go @@ -31,7 +31,7 @@ func Post(ctx context.Context, args config.Args, sizeLimit int, en entry.Entry) colour.Infoln("Not posting", en, "to Mastodon as dry-run enabled") return nil } - if content, err = prompt.FileAction("Do you want to post this message to Mastodon?", content, en.Path); err != nil { + if _, err = prompt.FileAction("Do you want to post this message to Mastodon?", content, en.Path); err != nil { return err } diff --git a/internal/prompt/file.go b/internal/prompt/file.go index 9668aed..5d7212b 100644 --- a/internal/prompt/file.go +++ b/internal/prompt/file.go @@ -17,6 +17,11 @@ var ( ErrDeleted = errors.New("deleted") ) +// type entry interface { +// Path() string +// ContentWithLimit(int) (string, error) +// } + // TODO: Add option to randomly select another entry when no selected? func FileAction(question, content, filePath string) (string, error) { colour.Info2f(filePath + ":") |
