From 114537dcc024aaead8dff8f9f7627e87daceb7d4 Mon Sep 17 00:00:00 2001 From: Mark Ayers Date: Sat, 12 Nov 2022 07:39:47 -0500 Subject: [PATCH 1/8] Update install instruction --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 23607a6..989d6e4 100644 --- a/README.md +++ b/README.md @@ -153,8 +153,8 @@ func main() { ## Installation -``` -$ go get github.com/mattn/go-mastodon +```shell +go install github.com/mattn/go-mastodon@latest ``` ## License From 309dce6ff3f1b04b74c282c01de7256bb140bdde Mon Sep 17 00:00:00 2001 From: Darren O'Connor Date: Sun, 13 Nov 2022 21:14:40 +0000 Subject: [PATCH 2/8] minor spelling fixes --- accounts.go | 40 ++++++++++++++++++++-------------------- apps.go | 2 +- instance.go | 12 ++++++------ mastodon.go | 6 +++--- notification.go | 8 ++++---- polls.go | 6 +++--- report.go | 4 ++-- status.go | 26 +++++++++++++------------- streaming.go | 20 ++++++++++---------- 9 files changed, 62 insertions(+), 62 deletions(-) diff --git a/accounts.go b/accounts.go index a5e6823..0b43e4c 100644 --- a/accounts.go +++ b/accounts.go @@ -9,7 +9,7 @@ import ( "time" ) -// Account hold information for mastodon account. +// Account holds information for a mastodon account. type Account struct { ID ID `json:"id"` Username string `json:"username"` @@ -60,7 +60,7 @@ func (c *Client) GetAccount(ctx context.Context, id ID) (*Account, error) { return &account, nil } -// GetAccountCurrentUser return Account of current user. +// GetAccountCurrentUser returns the Account of current user. func (c *Client) GetAccountCurrentUser(ctx context.Context) (*Account, error) { var account Account err := c.doAPI(ctx, http.MethodGet, "/api/v1/accounts/verify_credentials", nil, &account, nil) @@ -129,7 +129,7 @@ func (c *Client) AccountUpdate(ctx context.Context, profile *Profile) (*Account, return &account, nil } -// GetAccountStatuses return statuses by specified accuont. +// GetAccountStatuses return statuses by specified account. func (c *Client) GetAccountStatuses(ctx context.Context, id ID, pg *Pagination) ([]*Status, error) { var statuses []*Status err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/statuses", url.PathEscape(string(id))), nil, &statuses, pg) @@ -139,7 +139,7 @@ func (c *Client) GetAccountStatuses(ctx context.Context, id ID, pg *Pagination) return statuses, nil } -// GetAccountPinnedStatuses return statuses pinned by specified accuont. +// GetAccountPinnedStatuses returns statuses pinned by specified accuont. func (c *Client) GetAccountPinnedStatuses(ctx context.Context, id ID) ([]*Status, error) { var statuses []*Status params := url.Values{} @@ -151,7 +151,7 @@ func (c *Client) GetAccountPinnedStatuses(ctx context.Context, id ID) ([]*Status return statuses, nil } -// GetAccountFollowers return followers list. +// GetAccountFollowers returns followers list. func (c *Client) GetAccountFollowers(ctx context.Context, id ID, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/followers", url.PathEscape(string(id))), nil, &accounts, pg) @@ -161,7 +161,7 @@ func (c *Client) GetAccountFollowers(ctx context.Context, id ID, pg *Pagination) return accounts, nil } -// GetAccountFollowing return following list. +// GetAccountFollowing returns following list. func (c *Client) GetAccountFollowing(ctx context.Context, id ID, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s/following", url.PathEscape(string(id))), nil, &accounts, pg) @@ -171,7 +171,7 @@ func (c *Client) GetAccountFollowing(ctx context.Context, id ID, pg *Pagination) return accounts, nil } -// GetBlocks return block list. +// GetBlocks returns block list. func (c *Client) GetBlocks(ctx context.Context, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, "/api/v1/blocks", nil, &accounts, pg) @@ -181,7 +181,7 @@ func (c *Client) GetBlocks(ctx context.Context, pg *Pagination) ([]*Account, err return accounts, nil } -// Relationship hold information for relation-ship to the account. +// Relationship holds information for relationship to the account. type Relationship struct { ID ID `json:"id"` Following bool `json:"following"` @@ -195,7 +195,7 @@ type Relationship struct { Endorsed bool `json:"endorsed"` } -// AccountFollow follow the account. +// AccountFollow follows the account. func (c *Client) AccountFollow(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/follow", url.PathEscape(string(id))), nil, &relationship, nil) @@ -205,7 +205,7 @@ func (c *Client) AccountFollow(ctx context.Context, id ID) (*Relationship, error return &relationship, nil } -// AccountUnfollow unfollow the account. +// AccountUnfollow unfollows the account. func (c *Client) AccountUnfollow(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/unfollow", url.PathEscape(string(id))), nil, &relationship, nil) @@ -215,7 +215,7 @@ func (c *Client) AccountUnfollow(ctx context.Context, id ID) (*Relationship, err return &relationship, nil } -// AccountBlock block the account. +// AccountBlock blocks the account. func (c *Client) AccountBlock(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/block", url.PathEscape(string(id))), nil, &relationship, nil) @@ -225,7 +225,7 @@ func (c *Client) AccountBlock(ctx context.Context, id ID) (*Relationship, error) return &relationship, nil } -// AccountUnblock unblock the account. +// AccountUnblock unblocks the account. func (c *Client) AccountUnblock(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/unblock", url.PathEscape(string(id))), nil, &relationship, nil) @@ -235,7 +235,7 @@ func (c *Client) AccountUnblock(ctx context.Context, id ID) (*Relationship, erro return &relationship, nil } -// AccountMute mute the account. +// AccountMute mutes the account. func (c *Client) AccountMute(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/mute", url.PathEscape(string(id))), nil, &relationship, nil) @@ -245,7 +245,7 @@ func (c *Client) AccountMute(ctx context.Context, id ID) (*Relationship, error) return &relationship, nil } -// AccountUnmute unmute the account. +// AccountUnmute unmutes the account. func (c *Client) AccountUnmute(ctx context.Context, id ID) (*Relationship, error) { var relationship Relationship err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/accounts/%s/unmute", url.PathEscape(string(id))), nil, &relationship, nil) @@ -255,7 +255,7 @@ func (c *Client) AccountUnmute(ctx context.Context, id ID) (*Relationship, error return &relationship, nil } -// GetAccountRelationships return relationship for the account. +// GetAccountRelationships returns relationship for the account. func (c *Client) GetAccountRelationships(ctx context.Context, ids []string) ([]*Relationship, error) { params := url.Values{} for _, id := range ids { @@ -270,7 +270,7 @@ func (c *Client) GetAccountRelationships(ctx context.Context, ids []string) ([]* return relationships, nil } -// AccountsSearch search accounts by query. +// AccountsSearch searches accounts by query. func (c *Client) AccountsSearch(ctx context.Context, q string, limit int64) ([]*Account, error) { params := url.Values{} params.Set("q", q) @@ -284,7 +284,7 @@ func (c *Client) AccountsSearch(ctx context.Context, q string, limit int64) ([]* return accounts, nil } -// FollowRemoteUser send follow-request. +// FollowRemoteUser sends follow-request. func (c *Client) FollowRemoteUser(ctx context.Context, uri string) (*Account, error) { params := url.Values{} params.Set("uri", uri) @@ -297,7 +297,7 @@ func (c *Client) FollowRemoteUser(ctx context.Context, uri string) (*Account, er return &account, nil } -// GetFollowRequests return follow-requests. +// GetFollowRequests returns follow requests. func (c *Client) GetFollowRequests(ctx context.Context, pg *Pagination) ([]*Account, error) { var accounts []*Account err := c.doAPI(ctx, http.MethodGet, "/api/v1/follow_requests", nil, &accounts, pg) @@ -307,12 +307,12 @@ func (c *Client) GetFollowRequests(ctx context.Context, pg *Pagination) ([]*Acco return accounts, nil } -// FollowRequestAuthorize is authorize the follow request of user with id. +// FollowRequestAuthorize authorizes the follow request of user with id. func (c *Client) FollowRequestAuthorize(ctx context.Context, id ID) error { return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/follow_requests/%s/authorize", url.PathEscape(string(id))), nil, nil, nil) } -// FollowRequestReject is rejects the follow request of user with id. +// FollowRequestReject rejects the follow request of user with id. func (c *Client) FollowRequestReject(ctx context.Context, id ID) error { return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/follow_requests/%s/reject", url.PathEscape(string(id))), nil, nil, nil) } diff --git a/apps.go b/apps.go index d113909..c885ec9 100644 --- a/apps.go +++ b/apps.go @@ -27,7 +27,7 @@ type AppConfig struct { Website string } -// Application is mastodon application. +// Application is a mastodon application. type Application struct { ID ID `json:"id"` RedirectURI string `json:"redirect_uri"` diff --git a/instance.go b/instance.go index d74322f..672120c 100644 --- a/instance.go +++ b/instance.go @@ -5,7 +5,7 @@ import ( "net/http" ) -// Instance hold information for mastodon instance. +// Instance holds information for a mastodon instance. type Instance struct { URI string `json:"uri"` Title string `json:"title"` @@ -19,14 +19,14 @@ type Instance struct { ContactAccount *Account `json:"contact_account"` } -// InstanceStats hold information for mastodon instance stats. +// InstanceStats holds information for mastodon instance stats. type InstanceStats struct { UserCount int64 `json:"user_count"` StatusCount int64 `json:"status_count"` DomainCount int64 `json:"domain_count"` } -// GetInstance return Instance. +// GetInstance returns Instance. func (c *Client) GetInstance(ctx context.Context) (*Instance, error) { var instance Instance err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance", nil, &instance, nil) @@ -36,7 +36,7 @@ func (c *Client) GetInstance(ctx context.Context) (*Instance, error) { return &instance, nil } -// WeeklyActivity hold information for mastodon weekly activity. +// WeeklyActivity holds information for mastodon weekly activity. type WeeklyActivity struct { Week Unixtime `json:"week"` Statuses int64 `json:"statuses,string"` @@ -44,7 +44,7 @@ type WeeklyActivity struct { Registrations int64 `json:"registrations,string"` } -// GetInstanceActivity return instance activity. +// GetInstanceActivity returns instance activity. func (c *Client) GetInstanceActivity(ctx context.Context) ([]*WeeklyActivity, error) { var activity []*WeeklyActivity err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance/activity", nil, &activity, nil) @@ -54,7 +54,7 @@ func (c *Client) GetInstanceActivity(ctx context.Context) ([]*WeeklyActivity, er return activity, nil } -// GetInstancePeers return instance peers. +// GetInstancePeers returns instance peers. func (c *Client) GetInstancePeers(ctx context.Context) ([]string, error) { var peers []string err := c.doAPI(ctx, http.MethodGet, "/api/v1/instance/peers", nil, &peers, nil) diff --git a/mastodon.go b/mastodon.go index 5b43308..0706981 100644 --- a/mastodon.go +++ b/mastodon.go @@ -128,7 +128,7 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in return json.NewDecoder(resp.Body).Decode(&res) } -// NewClient return new mastodon API client. +// NewClient returns a new mastodon API client. func NewClient(config *Config) *Client { return &Client{ Client: *http.DefaultClient, @@ -136,7 +136,7 @@ func NewClient(config *Config) *Client { } } -// Authenticate get access-token to the API. +// Authenticate gets access-token to the API. func (c *Client) Authenticate(ctx context.Context, username, password string) error { params := url.Values{ "client_id": {c.Config.ClientID}, @@ -222,7 +222,7 @@ const ( VisibilityDirectMessage = "direct" ) -// Toot is struct to post status. +// Toot is a struct to post status. type Toot struct { Status string `json:"status"` InReplyToID ID `json:"in_reply_to_id"` diff --git a/notification.go b/notification.go index b24b9df..fa0cab9 100644 --- a/notification.go +++ b/notification.go @@ -12,7 +12,7 @@ import ( "time" ) -// Notification hold information for mastodon notification. +// Notification holds information for a mastodon notification. type Notification struct { ID ID `json:"id"` Type string `json:"type"` @@ -35,7 +35,7 @@ type PushAlerts struct { Mention *Sbool `json:"mention"` } -// GetNotifications return notifications. +// GetNotifications returns notifications. func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notification, error) { var notifications []*Notification err := c.doAPI(ctx, http.MethodGet, "/api/v1/notifications", nil, ¬ifications, pg) @@ -45,7 +45,7 @@ func (c *Client) GetNotifications(ctx context.Context, pg *Pagination) ([]*Notif return notifications, nil } -// GetNotification return notification. +// GetNotification returns notification. func (c *Client) GetNotification(ctx context.Context, id ID) (*Notification, error) { var notification Notification err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/notifications/%v", id), nil, ¬ification, nil) @@ -60,7 +60,7 @@ func (c *Client) DismissNotification(ctx context.Context, id ID) error { return c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/notifications/%v/dismiss", id), nil, nil, nil) } -// ClearNotifications clear notifications. +// ClearNotifications clears notifications. func (c *Client) ClearNotifications(ctx context.Context) error { return c.doAPI(ctx, http.MethodPost, "/api/v1/notifications/clear", nil, nil, nil) } diff --git a/polls.go b/polls.go index e2a45f3..16be421 100644 --- a/polls.go +++ b/polls.go @@ -8,7 +8,7 @@ import ( "time" ) -// Poll hold information for mastodon polls. +// Poll holds information for mastodon polls. type Poll struct { ID ID `json:"id"` ExpiresAt time.Time `json:"expires_at"` @@ -22,13 +22,13 @@ type Poll struct { Emojis []Emoji `json:"emojis"` } -// Poll hold information for a mastodon poll option. +// Poll holds information for a mastodon poll option. type PollOption struct { Title string `json:"title"` VotesCount int64 `json:"votes_count"` } -// GetPoll return poll specified by id. +// GetPoll returns poll specified by id. func (c *Client) GetPoll(ctx context.Context, id ID) (*Poll, error) { var poll Poll err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/polls/%s", id), nil, &poll, nil) diff --git a/report.go b/report.go index 94ae0dc..662c16a 100644 --- a/report.go +++ b/report.go @@ -6,13 +6,13 @@ import ( "net/url" ) -// Report hold information for mastodon report. +// Report holds information for a mastodon report. type Report struct { ID int64 `json:"id"` ActionTaken bool `json:"action_taken"` } -// GetReports return report of the current user. +// GetReports returns report of the current user. func (c *Client) GetReports(ctx context.Context) ([]*Report, error) { var reports []*Report err := c.doAPI(ctx, http.MethodGet, "/api/v1/reports", nil, &reports, nil) diff --git a/status.go b/status.go index 5cdbf22..1e8f590 100644 --- a/status.go +++ b/status.go @@ -45,13 +45,13 @@ type Status struct { Pinned interface{} `json:"pinned"` } -// Context hold information for mastodon context. +// Context holds information for a mastodon context. type Context struct { Ancestors []*Status `json:"ancestors"` Descendants []*Status `json:"descendants"` } -// Card hold information for mastodon card. +// Card holds information for a mastodon card. type Card struct { URL string `json:"url"` Title string `json:"title"` @@ -67,7 +67,7 @@ type Card struct { Height int64 `json:"height"` } -// Conversation hold information for mastodon conversation. +// Conversation holds information for a mastodon conversation. type Conversation struct { ID ID `json:"id"` Accounts []*Account `json:"accounts"` @@ -140,7 +140,7 @@ func (m *Media) bodyAndContentType() (io.Reader, string, error) { return &buf, mw.FormDataContentType(), nil } -// GetFavourites return the favorite list of the current user. +// GetFavourites returns the favorite list of the current user. func (c *Client) GetFavourites(ctx context.Context, pg *Pagination) ([]*Status, error) { var statuses []*Status err := c.doAPI(ctx, http.MethodGet, "/api/v1/favourites", nil, &statuses, pg) @@ -150,7 +150,7 @@ func (c *Client) GetFavourites(ctx context.Context, pg *Pagination) ([]*Status, return statuses, nil } -// GetBookmarks return the bookmark list of the current user. +// GetBookmarks returns the bookmark list of the current user. func (c *Client) GetBookmarks(ctx context.Context, pg *Pagination) ([]*Status, error) { var statuses []*Status err := c.doAPI(ctx, http.MethodGet, "/api/v1/bookmarks", nil, &statuses, pg) @@ -160,7 +160,7 @@ func (c *Client) GetBookmarks(ctx context.Context, pg *Pagination) ([]*Status, e return statuses, nil } -// GetStatus return status specified by id. +// GetStatus returns status specified by id. func (c *Client) GetStatus(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/statuses/%s", id), nil, &status, nil) @@ -170,7 +170,7 @@ func (c *Client) GetStatus(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// GetStatusContext return status specified by id. +// GetStatusContext returns status specified by id. func (c *Client) GetStatusContext(ctx context.Context, id ID) (*Context, error) { var context Context err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/statuses/%s/context", id), nil, &context, nil) @@ -180,7 +180,7 @@ func (c *Client) GetStatusContext(ctx context.Context, id ID) (*Context, error) return &context, nil } -// GetStatusCard return status specified by id. +// GetStatusCard returns status specified by id. func (c *Client) GetStatusCard(ctx context.Context, id ID) (*Card, error) { var card Card err := c.doAPI(ctx, http.MethodGet, fmt.Sprintf("/api/v1/statuses/%s/card", id), nil, &card, nil) @@ -210,7 +210,7 @@ func (c *Client) GetFavouritedBy(ctx context.Context, id ID, pg *Pagination) ([] return accounts, nil } -// Reblog is reblog the toot of id and return status of reblog. +// Reblog reblogs the toot of id and returns status of reblog. func (c *Client) Reblog(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/reblog", id), nil, &status, nil) @@ -220,7 +220,7 @@ func (c *Client) Reblog(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Unreblog is unreblog the toot of id and return status of the original toot. +// Unreblog unreblogs the toot of id and returns status of the original toot. func (c *Client) Unreblog(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/unreblog", id), nil, &status, nil) @@ -230,7 +230,7 @@ func (c *Client) Unreblog(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Favourite is favourite the toot of id and return status of the favourite toot. +// Favourite favourites the toot of id and returns status of the favourite toot. func (c *Client) Favourite(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/favourite", id), nil, &status, nil) @@ -240,7 +240,7 @@ func (c *Client) Favourite(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Unfavourite is unfavourite the toot of id and return status of the unfavourite toot. +// Unfavourite unfavourites the toot of id and returns status of the unfavourite toot. func (c *Client) Unfavourite(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/unfavourite", id), nil, &status, nil) @@ -250,7 +250,7 @@ func (c *Client) Unfavourite(ctx context.Context, id ID) (*Status, error) { return &status, nil } -// Bookmark is bookmark the toot of id and return status of the bookmark toot. +// Bookmark bookmarks the toot of id and returns status of the bookmark toot. func (c *Client) Bookmark(ctx context.Context, id ID) (*Status, error) { var status Status err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/bookmark", id), nil, &status, nil) diff --git a/streaming.go b/streaming.go index 615efec..2439d67 100644 --- a/streaming.go +++ b/streaming.go @@ -13,32 +13,32 @@ import ( "strings" ) -// UpdateEvent is struct for passing status event to app. +// UpdateEvent is a struct for passing status event to app. type UpdateEvent struct { Status *Status `json:"status"` } func (e *UpdateEvent) event() {} -// NotificationEvent is struct for passing notification event to app. +// NotificationEvent is a struct for passing notification event to app. type NotificationEvent struct { Notification *Notification `json:"notification"` } func (e *NotificationEvent) event() {} -// DeleteEvent is struct for passing deletion event to app. +// DeleteEvent is a struct for passing deletion event to app. type DeleteEvent struct{ ID ID } func (e *DeleteEvent) event() {} -// ErrorEvent is struct for passing errors to app. +// ErrorEvent is a struct for passing errors to app. type ErrorEvent struct{ err error } func (e *ErrorEvent) event() {} func (e *ErrorEvent) Error() string { return e.err.Error() } -// Event is interface passing events to app. +// Event is an interface passing events to app. type Event interface { event() } @@ -150,12 +150,12 @@ func (c *Client) doStreaming(req *http.Request, q chan Event) { } } -// StreamingUser return channel to read events on home. +// StreamingUser returns a channel to read events on home. func (c *Client) StreamingUser(ctx context.Context) (chan Event, error) { return c.streaming(ctx, "user", nil) } -// StreamingPublic return channel to read events on public. +// StreamingPublic returns a channel to read events on public. func (c *Client) StreamingPublic(ctx context.Context, isLocal bool) (chan Event, error) { p := "public" if isLocal { @@ -165,7 +165,7 @@ func (c *Client) StreamingPublic(ctx context.Context, isLocal bool) (chan Event, return c.streaming(ctx, p, nil) } -// StreamingHashtag return channel to read events on tagged timeline. +// StreamingHashtag returns a channel to read events on tagged timeline. func (c *Client) StreamingHashtag(ctx context.Context, tag string, isLocal bool) (chan Event, error) { params := url.Values{} params.Set("tag", tag) @@ -178,7 +178,7 @@ func (c *Client) StreamingHashtag(ctx context.Context, tag string, isLocal bool) return c.streaming(ctx, p, params) } -// StreamingList return channel to read events on a list. +// StreamingList returns a channel to read events on a list. func (c *Client) StreamingList(ctx context.Context, id ID) (chan Event, error) { params := url.Values{} params.Set("list", string(id)) @@ -186,7 +186,7 @@ func (c *Client) StreamingList(ctx context.Context, id ID) (chan Event, error) { return c.streaming(ctx, "list", params) } -// StreamingDirect return channel to read events on a direct messages. +// StreamingDirect returns a channel to read events on a direct messages. func (c *Client) StreamingDirect(ctx context.Context) (chan Event, error) { return c.streaming(ctx, "direct", nil) } From e5c082de35cc4cb5a0837572ccce5578c64f32e9 Mon Sep 17 00:00:00 2001 From: Darren O'Connor Date: Tue, 15 Nov 2022 02:54:56 +0000 Subject: [PATCH 3/8] Add UploadMediaFromBytes function --- status.go | 7 ++++++- status_test.go | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/status.go b/status.go index 1e8f590..e616366 100644 --- a/status.go +++ b/status.go @@ -409,7 +409,12 @@ func (c *Client) UploadMedia(ctx context.Context, file string) (*Attachment, err return c.UploadMediaFromMedia(ctx, &Media{File: f}) } -// UploadMediaFromReader uploads a media attachment from a io.Reader. +// UploadMediaFromBytes uploads a media attachment from a byte slice. +func (c *Client) UploadMediaFromBytes(ctx context.Context, b []byte) (*Attachment, error) { + return c.UploadMediaFromReader(ctx, bytes.NewReader(b)) +} + +// UploadMediaFromReader uploads a media attachment from an io.Reader. func (c *Client) UploadMediaFromReader(ctx context.Context, reader io.Reader) (*Attachment, error) { return c.UploadMediaFromMedia(ctx, &Media{File: reader}) } diff --git a/status_test.go b/status_test.go index 0a5231f..617a687 100644 --- a/status_test.go +++ b/status_test.go @@ -708,6 +708,18 @@ func TestUploadMedia(t *testing.T) { if writerAttachment.ID != "123" { t.Fatalf("want %q but %q", "123", attachment.ID) } + bytes, err := os.ReadFile("testdata/logo.png") + if err != nil { + t.Fatalf("could not open file: %v", err) + } + byteAttachment, err := client.UploadMediaFromBytes(context.Background(), bytes) + if err != nil { + t.Fatalf("should not be fail: %v", err) + } + if byteAttachment.ID != "123" { + t.Fatalf("want %q but got %q", "123", attachment.ID) + } + } func TestGetConversations(t *testing.T) { From f76d33a68c7fe66d244bd156ed27f3860b8938f2 Mon Sep 17 00:00:00 2001 From: Darren O'Connor Date: Tue, 15 Nov 2022 03:00:46 +0000 Subject: [PATCH 4/8] switch os.ReadFile to ioutil.ReadFile due to Ubuntu 15 test failing --- status_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/status_test.go b/status_test.go index 617a687..0047617 100644 --- a/status_test.go +++ b/status_test.go @@ -3,6 +3,7 @@ package mastodon import ( "context" "fmt" + "io/ioutil" "net/http" "net/http/httptest" "os" @@ -708,7 +709,7 @@ func TestUploadMedia(t *testing.T) { if writerAttachment.ID != "123" { t.Fatalf("want %q but %q", "123", attachment.ID) } - bytes, err := os.ReadFile("testdata/logo.png") + bytes, err := ioutil.ReadFile("testdata/logo.png") if err != nil { t.Fatalf("could not open file: %v", err) } From 9e1af56ceb351f24f23bad9ba2b7889cd1c270cc Mon Sep 17 00:00:00 2001 From: Darren O'Connor Date: Wed, 16 Nov 2022 01:43:29 +0000 Subject: [PATCH 5/8] remove redundent return statements --- accounts_test.go | 15 --------------- apps_test.go | 2 -- lists_test.go | 9 --------- mastodon_test.go | 7 ------- notification_test.go | 2 -- report_test.go | 2 -- status_test.go | 22 ---------------------- 7 files changed, 59 deletions(-) diff --git a/accounts_test.go b/accounts_test.go index 73f59c2..473e9b6 100644 --- a/accounts_test.go +++ b/accounts_test.go @@ -118,7 +118,6 @@ func TestGetAccountStatuses(t *testing.T) { return } fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) - return })) defer ts.Close() @@ -156,7 +155,6 @@ func TestGetAccountPinnedStatuses(t *testing.T) { return } fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) - return })) defer ts.Close() @@ -189,7 +187,6 @@ func TestGetAccountFollowers(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() @@ -225,7 +222,6 @@ func TestGetAccountFollowing(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() @@ -263,7 +259,6 @@ func TestGetBlocks(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() @@ -299,7 +294,6 @@ func TestAccountFollow(t *testing.T) { return } fmt.Fprintln(w, `{"id":1234567,"following":true}`) - return })) defer ts.Close() @@ -332,7 +326,6 @@ func TestAccountUnfollow(t *testing.T) { return } fmt.Fprintln(w, `{"id":1234567,"following":false}`) - return })) defer ts.Close() @@ -365,7 +358,6 @@ func TestAccountBlock(t *testing.T) { return } fmt.Fprintln(w, `{"id":1234567,"blocking":true}`) - return })) defer ts.Close() @@ -398,7 +390,6 @@ func TestAccountUnblock(t *testing.T) { return } fmt.Fprintln(w, `{"id":1234567,"blocking":false}`) - return })) defer ts.Close() @@ -431,7 +422,6 @@ func TestAccountMute(t *testing.T) { return } fmt.Fprintln(w, `{"id":1234567,"muting":true}`) - return })) defer ts.Close() @@ -464,7 +454,6 @@ func TestAccountUnmute(t *testing.T) { return } fmt.Fprintln(w, `{"id":1234567,"muting":false}`) - return })) defer ts.Close() @@ -530,7 +519,6 @@ func TestAccountsSearch(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foobar"}, {"username": "barfoo"}]`) - return })) defer ts.Close() @@ -566,7 +554,6 @@ func TestFollowRemoteUser(t *testing.T) { return } fmt.Fprintln(w, `{"username": "zzz"}`) - return })) defer ts.Close() @@ -598,7 +585,6 @@ func TestGetFollowRequests(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() @@ -684,7 +670,6 @@ func TestGetMutes(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() diff --git a/apps_test.go b/apps_test.go index 8734234..b8403e8 100644 --- a/apps_test.go +++ b/apps_test.go @@ -27,7 +27,6 @@ func TestRegisterApp(t *testing.T) { return } fmt.Fprintln(w, `{"id": 123, "client_id": "foo", "client_secret": "bar"}`) - return })) defer ts.Close() @@ -79,7 +78,6 @@ func TestRegisterAppWithCancel(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(3 * time.Second) fmt.Fprintln(w, `{"client_id": "foo", "client_secret": "bar"}`) - return })) defer ts.Close() diff --git a/lists_test.go b/lists_test.go index b6f400e..5cca304 100644 --- a/lists_test.go +++ b/lists_test.go @@ -15,7 +15,6 @@ func TestGetLists(t *testing.T) { return } fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`) - return })) defer ts.Close() @@ -47,7 +46,6 @@ func TestGetAccountLists(t *testing.T) { return } fmt.Fprintln(w, `[{"id": "1", "title": "foo"}, {"id": "2", "title": "bar"}]`) - return })) defer ts.Close() @@ -83,7 +81,6 @@ func TestGetListAccounts(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() @@ -119,7 +116,6 @@ func TestGetList(t *testing.T) { return } fmt.Fprintln(w, `{"id": "1", "title": "foo"}`) - return })) defer ts.Close() @@ -149,7 +145,6 @@ func TestCreateList(t *testing.T) { return } fmt.Fprintln(w, `{"id": "1", "title": "foo"}`) - return })) defer ts.Close() @@ -183,7 +178,6 @@ func TestRenameList(t *testing.T) { return } fmt.Fprintln(w, `{"id": "1", "title": "bar"}`) - return })) defer ts.Close() @@ -216,7 +210,6 @@ func TestDeleteList(t *testing.T) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) return } - return })) defer ts.Close() @@ -246,7 +239,6 @@ func TestAddToList(t *testing.T) { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } - return })) defer ts.Close() @@ -272,7 +264,6 @@ func TestRemoveFromList(t *testing.T) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) return } - return })) defer ts.Close() diff --git a/mastodon_test.go b/mastodon_test.go index 527dd89..ff3fc5c 100644 --- a/mastodon_test.go +++ b/mastodon_test.go @@ -96,7 +96,6 @@ func TestAuthenticate(t *testing.T) { return } fmt.Fprintln(w, `{"access_token": "zoo"}`) - return })) defer ts.Close() @@ -124,7 +123,6 @@ func TestAuthenticate(t *testing.T) { func TestAuthenticateWithCancel(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(3 * time.Second) - return })) defer ts.Close() @@ -151,7 +149,6 @@ func TestAuthenticateApp(t *testing.T) { return } fmt.Fprintln(w, `{"name":"zzz","website":"yyy","vapid_key":"xxx"}`) - return })) defer ts.Close() @@ -183,7 +180,6 @@ func TestPostStatus(t *testing.T) { return } fmt.Fprintln(w, `{"access_token": "zoo"}`) - return })) defer ts.Close() @@ -216,7 +212,6 @@ func TestPostStatus(t *testing.T) { func TestPostStatusWithCancel(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(3 * time.Second) - return })) defer ts.Close() @@ -351,7 +346,6 @@ func TestPostStatusParams(t *testing.T) { func TestGetTimelineHome(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) - return })) defer ts.Close() @@ -391,7 +385,6 @@ func TestGetTimelineHome(t *testing.T) { func TestGetTimelineHomeWithCancel(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { time.Sleep(3 * time.Second) - return })) defer ts.Close() diff --git a/notification_test.go b/notification_test.go index 28dc975..78cdbdd 100644 --- a/notification_test.go +++ b/notification_test.go @@ -28,7 +28,6 @@ func TestGetNotifications(t *testing.T) { return } http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) - return })) defer ts.Close() @@ -76,7 +75,6 @@ func TestPushSubscription(t *testing.T) { return } http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) - return })) defer ts.Close() diff --git a/report_test.go b/report_test.go index db7fadb..374f490 100644 --- a/report_test.go +++ b/report_test.go @@ -15,7 +15,6 @@ func TestGetReports(t *testing.T) { return } fmt.Fprintln(w, `[{"id": 122, "action_taken": false}, {"id": 123, "action_taken": true}]`) - return })) defer ts.Close() @@ -55,7 +54,6 @@ func TestReport(t *testing.T) { } else { fmt.Fprintln(w, `{"id": 1234, "action_taken": true}`) } - return })) defer ts.Close() diff --git a/status_test.go b/status_test.go index 0047617..5209668 100644 --- a/status_test.go +++ b/status_test.go @@ -13,7 +13,6 @@ import ( func TestGetFavourites(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) - return })) defer ts.Close() @@ -41,7 +40,6 @@ func TestGetFavourites(t *testing.T) { func TestGetBookmarks(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`) - return })) defer ts.Close() @@ -73,7 +71,6 @@ func TestGetStatus(t *testing.T) { return } fmt.Fprintln(w, `{"content": "zzz", "emojis":[{"shortcode":"💩", "url":"http://example.com", "static_url": "http://example.com/static"}]}`) - return })) defer ts.Close() @@ -115,7 +112,6 @@ func TestGetStatusCard(t *testing.T) { return } fmt.Fprintln(w, `{"title": "zzz"}`) - return })) defer ts.Close() @@ -145,7 +141,6 @@ func TestGetStatusContext(t *testing.T) { return } fmt.Fprintln(w, `{"ancestors": [{"content": "zzz"},{"content": "bbb"}]}`) - return })) defer ts.Close() @@ -184,7 +179,6 @@ func TestGetRebloggedBy(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() @@ -220,7 +214,6 @@ func TestGetFavouritedBy(t *testing.T) { return } fmt.Fprintln(w, `[{"username": "foo"}, {"username": "bar"}]`) - return })) defer ts.Close() @@ -256,7 +249,6 @@ func TestReblog(t *testing.T) { return } fmt.Fprintln(w, `{"content": "zzz"}`) - return })) defer ts.Close() @@ -286,7 +278,6 @@ func TestUnreblog(t *testing.T) { return } fmt.Fprintln(w, `{"content": "zzz"}`) - return })) defer ts.Close() @@ -316,7 +307,6 @@ func TestFavourite(t *testing.T) { return } fmt.Fprintln(w, `{"content": "zzz"}`) - return })) defer ts.Close() @@ -346,7 +336,6 @@ func TestUnfavourite(t *testing.T) { return } fmt.Fprintln(w, `{"content": "zzz"}`) - return })) defer ts.Close() @@ -376,7 +365,6 @@ func TestBookmark(t *testing.T) { return } fmt.Fprintln(w, `{"content": "zzz"}`) - return })) defer ts.Close() @@ -406,7 +394,6 @@ func TestUnbookmark(t *testing.T) { return } fmt.Fprintln(w, `{"content": "zzz"}`) - return })) defer ts.Close() @@ -488,7 +475,6 @@ func TestGetTimelineHashtag(t *testing.T) { return } fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`) - return })) defer ts.Close() @@ -524,7 +510,6 @@ func TestGetTimelineList(t *testing.T) { return } fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`) - return })) defer ts.Close() @@ -560,7 +545,6 @@ func TestGetTimelineMedia(t *testing.T) { return } fmt.Fprintln(w, `[{"content": "zzz"},{"content": "yyy"}]`) - return })) defer ts.Close() @@ -599,7 +583,6 @@ func TestDeleteStatus(t *testing.T) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) return } - return })) defer ts.Close() @@ -635,7 +618,6 @@ func TestSearch(t *testing.T) { "statuses":[{"content": "aaa"}], "hashtags":[{"name": "tag"},{"name": "tag2"},{"name": "tag3"}] }`) - return })) defer ts.Close() @@ -680,7 +662,6 @@ func TestUploadMedia(t *testing.T) { return } fmt.Fprintln(w, `{"id": 123}`) - return })) defer ts.Close() @@ -729,7 +710,6 @@ func TestGetConversations(t *testing.T) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) } fmt.Fprintln(w, `[{"id": "4", "unread":false, "last_status" : {"content": "zzz"}}, {"id": "3", "unread":true, "last_status" : {"content": "bar"}}]`) - return })) defer ts.Close() @@ -767,7 +747,6 @@ func TestDeleteConversation(t *testing.T) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusMethodNotAllowed) return } - return })) defer ts.Close() @@ -793,7 +772,6 @@ func TestMarkConversationsAsRead(t *testing.T) { http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) return } - return })) defer ts.Close() From be6120570837cb461e6c52349d7917154af8af87 Mon Sep 17 00:00:00 2001 From: Darren O'Connor Date: Wed, 16 Nov 2022 01:57:22 +0000 Subject: [PATCH 6/8] Remove unused variables --- accounts_test.go | 8 ++++---- lists_test.go | 12 ++++++------ report_test.go | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/accounts_test.go b/accounts_test.go index 473e9b6..47e0310 100644 --- a/accounts_test.go +++ b/accounts_test.go @@ -303,11 +303,11 @@ func TestAccountFollow(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) - rel, err := client.AccountFollow(context.Background(), "123") + _, err := client.AccountFollow(context.Background(), "123") if err == nil { t.Fatalf("should be fail: %v", err) } - rel, err = client.AccountFollow(context.Background(), "1234567") + rel, err := client.AccountFollow(context.Background(), "1234567") if err != nil { t.Fatalf("should not be fail: %v", err) } @@ -335,11 +335,11 @@ func TestAccountUnfollow(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) - rel, err := client.AccountUnfollow(context.Background(), "123") + _, err := client.AccountUnfollow(context.Background(), "123") if err == nil { t.Fatalf("should be fail: %v", err) } - rel, err = client.AccountUnfollow(context.Background(), "1234567") + rel, err := client.AccountUnfollow(context.Background(), "1234567") if err != nil { t.Fatalf("should not be fail: %v", err) } diff --git a/lists_test.go b/lists_test.go index 5cca304..b1c9e3b 100644 --- a/lists_test.go +++ b/lists_test.go @@ -125,11 +125,11 @@ func TestGetList(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) - list, err := client.GetList(context.Background(), "2") + _, err := client.GetList(context.Background(), "2") if err == nil { t.Fatalf("should be fail: %v", err) } - list, err = client.GetList(context.Background(), "1") + list, err := client.GetList(context.Background(), "1") if err != nil { t.Fatalf("should not be fail: %v", err) } @@ -154,11 +154,11 @@ func TestCreateList(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) - list, err := client.CreateList(context.Background(), "") + _, err := client.CreateList(context.Background(), "") if err == nil { t.Fatalf("should be fail: %v", err) } - list, err = client.CreateList(context.Background(), "foo") + list, err := client.CreateList(context.Background(), "foo") if err != nil { t.Fatalf("should not be fail: %v", err) } @@ -187,11 +187,11 @@ func TestRenameList(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) - list, err := client.RenameList(context.Background(), "2", "bar") + _, err := client.RenameList(context.Background(), "2", "bar") if err == nil { t.Fatalf("should be fail: %v", err) } - list, err = client.RenameList(context.Background(), "1", "bar") + list, err := client.RenameList(context.Background(), "1", "bar") if err != nil { t.Fatalf("should not be fail: %v", err) } diff --git a/report_test.go b/report_test.go index 374f490..f25f0b5 100644 --- a/report_test.go +++ b/report_test.go @@ -63,11 +63,11 @@ func TestReport(t *testing.T) { ClientSecret: "bar", AccessToken: "zoo", }) - rp, err := client.Report(context.Background(), "121", nil, "") + _, err := client.Report(context.Background(), "121", nil, "") if err == nil { t.Fatalf("should be fail: %v", err) } - rp, err = client.Report(context.Background(), "122", nil, "") + rp, err := client.Report(context.Background(), "122", nil, "") if err != nil { t.Fatalf("should not be fail: %v", err) } From 5f0c9a21c2b068961ba897a628adb5897eec01d1 Mon Sep 17 00:00:00 2001 From: Rasmus Lindroth Date: Wed, 16 Nov 2022 20:20:18 +0100 Subject: [PATCH 7/8] add support for language --- mastodon.go | 1 + mastodon_test.go | 7 +++++++ status.go | 3 +++ 3 files changed, 11 insertions(+) diff --git a/mastodon.go b/mastodon.go index 0706981..c704e10 100644 --- a/mastodon.go +++ b/mastodon.go @@ -230,6 +230,7 @@ type Toot struct { Sensitive bool `json:"sensitive"` SpoilerText string `json:"spoiler_text"` Visibility string `json:"visibility"` + Language string `json:"language"` ScheduledAt *time.Time `json:"scheduled_at,omitempty"` Poll *TootPoll `json:"poll"` } diff --git a/mastodon_test.go b/mastodon_test.go index ff3fc5c..0ef9d07 100644 --- a/mastodon_test.go +++ b/mastodon_test.go @@ -252,6 +252,9 @@ func TestPostStatusParams(t *testing.T) { if r.FormValue("visibility") != "" { s.Visibility = (r.FormValue("visibility")) } + if r.FormValue("language") != "" { + s.Language = (r.FormValue("language")) + } if r.FormValue("sensitive") == "true" { s.Sensitive = true s.SpoilerText = fmt.Sprintf("

%s

", r.FormValue("spoiler_text")) @@ -288,6 +291,7 @@ func TestPostStatusParams(t *testing.T) { Status: "foobar", InReplyToID: ID("2"), Visibility: "unlisted", + Language: "sv", Sensitive: true, SpoilerText: "bar", MediaIDs: []ID{"1", "2"}, @@ -310,6 +314,9 @@ func TestPostStatusParams(t *testing.T) { if s.Visibility != "unlisted" { t.Fatalf("want %q but %q", "unlisted", s.Visibility) } + if s.Language != "sv" { + t.Fatalf("want %q but %q", "sv", s.Language) + } if s.Sensitive != true { t.Fatalf("want %t but %t", true, s.Sensitive) } diff --git a/status.go b/status.go index e616366..f5cc451 100644 --- a/status.go +++ b/status.go @@ -365,6 +365,9 @@ func (c *Client) PostStatus(ctx context.Context, toot *Toot) (*Status, error) { if toot.Visibility != "" { params.Set("visibility", fmt.Sprint(toot.Visibility)) } + if toot.Language != "" { + params.Set("language", fmt.Sprint(toot.Language)) + } if toot.Sensitive { params.Set("sensitive", "true") } From b597f437a9fd1514466f320235d236f7d468989a Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Sun, 27 Nov 2022 13:24:42 +0900 Subject: [PATCH 8/8] use urfave/cli/v2 --- cmd/mstdn/cmd_account.go | 2 +- cmd/mstdn/cmd_account_test.go | 2 +- cmd/mstdn/cmd_delete.go | 2 +- cmd/mstdn/cmd_delete_test.go | 2 +- cmd/mstdn/cmd_follow.go | 2 +- cmd/mstdn/cmd_follow_test.go | 2 +- cmd/mstdn/cmd_followers.go | 2 +- cmd/mstdn/cmd_followers_test.go | 2 +- cmd/mstdn/cmd_instance.go | 2 +- cmd/mstdn/cmd_instance_activity.go | 2 +- cmd/mstdn/cmd_instance_peers.go | 2 +- cmd/mstdn/cmd_instance_test.go | 2 +- cmd/mstdn/cmd_mikami.go | 2 +- cmd/mstdn/cmd_mikami_test.go | 2 +- cmd/mstdn/cmd_notification.go | 2 +- cmd/mstdn/cmd_notification_test.go | 2 +- cmd/mstdn/cmd_search.go | 2 +- cmd/mstdn/cmd_search_test.go | 2 +- cmd/mstdn/cmd_stream.go | 2 +- cmd/mstdn/cmd_test.go | 2 +- cmd/mstdn/cmd_timeline.go | 2 +- cmd/mstdn/cmd_timeline_test.go | 2 +- cmd/mstdn/cmd_toot.go | 2 +- cmd/mstdn/cmd_toot_test.go | 2 +- cmd/mstdn/cmd_upload.go | 2 +- cmd/mstdn/cmd_upload_test.go | 2 +- cmd/mstdn/cmd_xsearch.go | 2 +- cmd/mstdn/cmd_xsearch_test.go | 2 +- cmd/mstdn/go.mod | 3 ++- cmd/mstdn/go.sum | 20 +++++++++----------- cmd/mstdn/main.go | 18 +++++++++--------- cmd/mstdn/main_test.go | 2 +- 32 files changed, 49 insertions(+), 50 deletions(-) diff --git a/cmd/mstdn/cmd_account.go b/cmd/mstdn/cmd_account.go index 23083c2..6501769 100644 --- a/cmd/mstdn/cmd_account.go +++ b/cmd/mstdn/cmd_account.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdAccount(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_account_test.go b/cmd/mstdn/cmd_account_test.go index 8894451..d35a088 100644 --- a/cmd/mstdn/cmd_account_test.go +++ b/cmd/mstdn/cmd_account_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdAccount(t *testing.T) { diff --git a/cmd/mstdn/cmd_delete.go b/cmd/mstdn/cmd_delete.go index 092bad6..acc8a36 100644 --- a/cmd/mstdn/cmd_delete.go +++ b/cmd/mstdn/cmd_delete.go @@ -5,7 +5,7 @@ import ( "errors" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdDelete(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_delete_test.go b/cmd/mstdn/cmd_delete_test.go index e37442d..4e202ca 100644 --- a/cmd/mstdn/cmd_delete_test.go +++ b/cmd/mstdn/cmd_delete_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdDelete(t *testing.T) { diff --git a/cmd/mstdn/cmd_follow.go b/cmd/mstdn/cmd_follow.go index e064f03..ca87963 100644 --- a/cmd/mstdn/cmd_follow.go +++ b/cmd/mstdn/cmd_follow.go @@ -5,7 +5,7 @@ import ( "errors" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdFollow(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_follow_test.go b/cmd/mstdn/cmd_follow_test.go index e4f43c9..ce2cfce 100644 --- a/cmd/mstdn/cmd_follow_test.go +++ b/cmd/mstdn/cmd_follow_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdFollow(t *testing.T) { diff --git a/cmd/mstdn/cmd_followers.go b/cmd/mstdn/cmd_followers.go index bfacf8b..9d9f10f 100644 --- a/cmd/mstdn/cmd_followers.go +++ b/cmd/mstdn/cmd_followers.go @@ -6,7 +6,7 @@ import ( "time" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdFollowers(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_followers_test.go b/cmd/mstdn/cmd_followers_test.go index f8c5080..17b7f4c 100644 --- a/cmd/mstdn/cmd_followers_test.go +++ b/cmd/mstdn/cmd_followers_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdFollowers(t *testing.T) { diff --git a/cmd/mstdn/cmd_instance.go b/cmd/mstdn/cmd_instance.go index 5932c68..84042dd 100644 --- a/cmd/mstdn/cmd_instance.go +++ b/cmd/mstdn/cmd_instance.go @@ -6,7 +6,7 @@ import ( "sort" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdInstance(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_instance_activity.go b/cmd/mstdn/cmd_instance_activity.go index 199ba99..fa133c3 100644 --- a/cmd/mstdn/cmd_instance_activity.go +++ b/cmd/mstdn/cmd_instance_activity.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdInstanceActivity(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_instance_peers.go b/cmd/mstdn/cmd_instance_peers.go index 7a73d1d..86d8915 100644 --- a/cmd/mstdn/cmd_instance_peers.go +++ b/cmd/mstdn/cmd_instance_peers.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdInstancePeers(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_instance_test.go b/cmd/mstdn/cmd_instance_test.go index f5a6279..a8435ad 100644 --- a/cmd/mstdn/cmd_instance_test.go +++ b/cmd/mstdn/cmd_instance_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdInstance(t *testing.T) { diff --git a/cmd/mstdn/cmd_mikami.go b/cmd/mstdn/cmd_mikami.go index abbfc18..069dd44 100644 --- a/cmd/mstdn/cmd_mikami.go +++ b/cmd/mstdn/cmd_mikami.go @@ -1,7 +1,7 @@ package main import ( - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdMikami(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_mikami_test.go b/cmd/mstdn/cmd_mikami_test.go index 3fe9eae..3d61bf7 100644 --- a/cmd/mstdn/cmd_mikami_test.go +++ b/cmd/mstdn/cmd_mikami_test.go @@ -7,7 +7,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdMikami(t *testing.T) { diff --git a/cmd/mstdn/cmd_notification.go b/cmd/mstdn/cmd_notification.go index b32ba4e..177494f 100644 --- a/cmd/mstdn/cmd_notification.go +++ b/cmd/mstdn/cmd_notification.go @@ -6,7 +6,7 @@ import ( "github.com/fatih/color" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdNotification(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_notification_test.go b/cmd/mstdn/cmd_notification_test.go index 25a9429..aac67f3 100644 --- a/cmd/mstdn/cmd_notification_test.go +++ b/cmd/mstdn/cmd_notification_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdNotification(t *testing.T) { diff --git a/cmd/mstdn/cmd_search.go b/cmd/mstdn/cmd_search.go index 6d7e81b..c6bdd87 100644 --- a/cmd/mstdn/cmd_search.go +++ b/cmd/mstdn/cmd_search.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdSearch(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_search_test.go b/cmd/mstdn/cmd_search_test.go index f3509cc..fd5e740 100644 --- a/cmd/mstdn/cmd_search_test.go +++ b/cmd/mstdn/cmd_search_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdSearch(t *testing.T) { diff --git a/cmd/mstdn/cmd_stream.go b/cmd/mstdn/cmd_stream.go index 9626769..a0caa41 100644 --- a/cmd/mstdn/cmd_stream.go +++ b/cmd/mstdn/cmd_stream.go @@ -10,7 +10,7 @@ import ( "text/template" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) // SimpleJSON is a struct for output JSON for data to be simple used diff --git a/cmd/mstdn/cmd_test.go b/cmd/mstdn/cmd_test.go index 14043c3..ecb841f 100644 --- a/cmd/mstdn/cmd_test.go +++ b/cmd/mstdn/cmd_test.go @@ -6,7 +6,7 @@ import ( "net/http/httptest" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func testWithServer(h http.HandlerFunc, testFuncs ...func(*cli.App)) string { diff --git a/cmd/mstdn/cmd_timeline.go b/cmd/mstdn/cmd_timeline.go index c610966..987a5c4 100644 --- a/cmd/mstdn/cmd_timeline.go +++ b/cmd/mstdn/cmd_timeline.go @@ -4,7 +4,7 @@ import ( "context" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdTimeline(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_timeline_test.go b/cmd/mstdn/cmd_timeline_test.go index d08a9fc..e24ba14 100644 --- a/cmd/mstdn/cmd_timeline_test.go +++ b/cmd/mstdn/cmd_timeline_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdTimeline(t *testing.T) { diff --git a/cmd/mstdn/cmd_toot.go b/cmd/mstdn/cmd_toot.go index 7c2ee63..b777a65 100644 --- a/cmd/mstdn/cmd_toot.go +++ b/cmd/mstdn/cmd_toot.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdToot(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_toot_test.go b/cmd/mstdn/cmd_toot_test.go index 4f997f0..bc083be 100644 --- a/cmd/mstdn/cmd_toot_test.go +++ b/cmd/mstdn/cmd_toot_test.go @@ -5,7 +5,7 @@ import ( "net/http" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdToot(t *testing.T) { diff --git a/cmd/mstdn/cmd_upload.go b/cmd/mstdn/cmd_upload.go index 15f912e..68d8b70 100644 --- a/cmd/mstdn/cmd_upload.go +++ b/cmd/mstdn/cmd_upload.go @@ -6,7 +6,7 @@ import ( "fmt" "github.com/mattn/go-mastodon" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdUpload(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_upload_test.go b/cmd/mstdn/cmd_upload_test.go index 585d943..0e76bd1 100644 --- a/cmd/mstdn/cmd_upload_test.go +++ b/cmd/mstdn/cmd_upload_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdUpload(t *testing.T) { diff --git a/cmd/mstdn/cmd_xsearch.go b/cmd/mstdn/cmd_xsearch.go index 2c7950b..223d9fa 100644 --- a/cmd/mstdn/cmd_xsearch.go +++ b/cmd/mstdn/cmd_xsearch.go @@ -6,7 +6,7 @@ import ( "net/url" "github.com/PuerkitoBio/goquery" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func cmdXSearch(c *cli.Context) error { diff --git a/cmd/mstdn/cmd_xsearch_test.go b/cmd/mstdn/cmd_xsearch_test.go index f3dc105..43c2baa 100644 --- a/cmd/mstdn/cmd_xsearch_test.go +++ b/cmd/mstdn/cmd_xsearch_test.go @@ -8,7 +8,7 @@ import ( "strings" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestCmdXSearch(t *testing.T) { diff --git a/cmd/mstdn/go.mod b/cmd/mstdn/go.mod index 729c262..19d310d 100644 --- a/cmd/mstdn/go.mod +++ b/cmd/mstdn/go.mod @@ -9,6 +9,7 @@ require ( github.com/fatih/color v1.13.0 github.com/mattn/go-mastodon v0.0.4 github.com/mattn/go-tty v0.0.4 - github.com/urfave/cli v1.22.9 + github.com/urfave/cli v1.13.0 + github.com/urfave/cli/v2 v2.23.5 // indirect golang.org/x/net v0.0.0-20220531201128-c960675eff93 ) diff --git a/cmd/mstdn/go.sum b/cmd/mstdn/go.sum index 2006e2f..65758c5 100644 --- a/cmd/mstdn/go.sum +++ b/cmd/mstdn/go.sum @@ -1,9 +1,8 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U= github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI= github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= @@ -11,9 +10,8 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= @@ -22,15 +20,16 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-tty v0.0.4 h1:NVikla9X8MN0SQAqCYzpGyXv0jY7MNl3HOWD2dkle7E= github.com/mattn/go-tty v0.0.4/go.mod h1:u5GGXBtZU6RQoKV8gY5W6UhMudbR5vXnUe7j3pxse28= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 h1:nrZ3ySNYwJbSpD6ce9duiP+QkD3JuLCcWkdaehUS/3Y= github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80/go.mod h1:iFyPdL66DjUD96XmzVL3ZntbzcflLnznH0fr99w5VqE= -github.com/urfave/cli v1.22.9 h1:cv3/KhXGBGjEXLC4bH0sLuJ9BewaAbpk5oyMOveu4pw= -github.com/urfave/cli v1.22.9/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +github.com/urfave/cli v1.13.0 h1:kkpCmfxnnnWIie2rCljcvaVrNYmsFq1ynTJH5kn1Ip4= +github.com/urfave/cli v1.13.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/urfave/cli/v2 v2.23.5 h1:xbrU7tAYviSpqeR3X4nEFWUdB/uDZ6DE+HxmRU7Xtyw= +github.com/urfave/cli/v2 v2.23.5/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220531201128-c960675eff93 h1:MYimHLfoXEpOhqd/zgoA/uoXzHB86AEky4LAx5ij9xA= golang.org/x/net v0.0.0-20220531201128-c960675eff93/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -43,7 +42,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -52,4 +50,4 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cmd/mstdn/main.go b/cmd/mstdn/main.go index 141a364..db17144 100644 --- a/cmd/mstdn/main.go +++ b/cmd/mstdn/main.go @@ -17,7 +17,7 @@ import ( "github.com/fatih/color" "github.com/mattn/go-mastodon" "github.com/mattn/go-tty" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" "golang.org/x/net/html" ) @@ -183,23 +183,23 @@ func makeApp() *cli.App { app.Usage = "mastodon client" app.Version = "0.0.1" app.Flags = []cli.Flag{ - cli.StringFlag{ + &cli.StringFlag{ Name: "profile", Usage: "profile name", Value: "", }, } - app.Commands = []cli.Command{ + app.Commands = []*cli.Command{ { Name: "toot", Usage: "post toot", Flags: []cli.Flag{ - cli.StringFlag{ + &cli.StringFlag{ Name: "ff", Usage: "post utf-8 string from a file(\"-\" means STDIN)", Value: "", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "i", Usage: "in-reply-to", Value: "", @@ -211,19 +211,19 @@ func makeApp() *cli.App { Name: "stream", Usage: "stream statuses", Flags: []cli.Flag{ - cli.StringFlag{ + &cli.StringFlag{ Name: "type", Usage: "stream type (public,public/local,user:NAME,hashtag:TAG)", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "json", Usage: "output JSON", }, - cli.BoolFlag{ + &cli.BoolFlag{ Name: "simplejson", Usage: "output simple JSON", }, - cli.StringFlag{ + &cli.StringFlag{ Name: "template", Usage: "output with tamplate format", }, diff --git a/cmd/mstdn/main_test.go b/cmd/mstdn/main_test.go index 19e6ab1..123ab88 100644 --- a/cmd/mstdn/main_test.go +++ b/cmd/mstdn/main_test.go @@ -7,7 +7,7 @@ import ( "os" "testing" - "github.com/urfave/cli" + "github.com/urfave/cli/v2" ) func TestReadFileFile(t *testing.T) {