diff options
| author | Paul Buetow <paul@buetow.org> | 2024-10-22 21:47:57 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-10-22 21:47:57 +0300 |
| commit | 66327b1e5b03eb8f3eeb178e385c902e18afecae (patch) | |
| tree | 414a2cc1dcf9510e2043a39837de102da917553a /internal | |
| parent | 38eb6dda4c2084440e42e5667ab182592498016f (diff) | |
change color
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/platforms/linkedin/linkedin.go | 7 | ||||
| -rw-r--r-- | internal/platforms/mastodon/mastodon.go | 5 |
2 files changed, 8 insertions, 4 deletions
diff --git a/internal/platforms/linkedin/linkedin.go b/internal/platforms/linkedin/linkedin.go index f6d89f5..ff58b06 100644 --- a/internal/platforms/linkedin/linkedin.go +++ b/internal/platforms/linkedin/linkedin.go @@ -93,13 +93,16 @@ func callLinkedInAPI(ctx context.Context, personID, accessToken, content string) if err != nil { return err } - color.Cyan(string(body)) if resp.StatusCode != http.StatusCreated { - err = fmt.Errorf("failed to post to LinkedIn. Status: %s\n", resp.Status) + err = fmt.Errorf("failed to post to LinkedIn. Status: %s\n%s\n", + resp.Status, string(body)) if resp.StatusCode == http.StatusUnauthorized { err = errors.Join(err, errUnauthorized) } } + if err == nil { + color.New(color.FgWhite, color.BgGreen).Println("Successfully posted message to LinkedIn") + } return err } diff --git a/internal/platforms/mastodon/mastodon.go b/internal/platforms/mastodon/mastodon.go index 0a87d74..ad63872 100644 --- a/internal/platforms/mastodon/mastodon.go +++ b/internal/platforms/mastodon/mastodon.go @@ -57,11 +57,12 @@ func Post(ctx context.Context, args config.Args, sizeLimit int, ent entry.Entry) if err != nil { return err } - color.Cyan(string(body)) if resp.StatusCode != http.StatusOK { - return fmt.Errorf("unexpected status code: %d", resp.StatusCode) + return fmt.Errorf("unexpected status code: %d\n%s\n", + resp.StatusCode, string(body)) } + color.New(color.FgWhite, color.BgGreen).Println("Successfully posted message to Mastodon") return nil } |
