diff --git a/internal/executor/consts.go b/internal/executor/consts.go new file mode 100644 index 0000000..788ffa8 --- /dev/null +++ b/internal/executor/consts.go @@ -0,0 +1,29 @@ +package executor + +const ( + flagFrom string = "from" + flagTo string = "to" + flagType string = "type" + + resourceAccount string = "account" + resourceBlocked string = "blocked" + resourceBookmarks string = "bookmarks" + resourceBoost string = "boost" + resourceFollowers string = "followers" + resourceFollowing string = "following" + resourceFollowRequest string = "follow-request" + resourceInstance string = "instance" + resourceLike string = "like" + resourceLiked string = "liked" + resourceList string = "list" + resourceMedia string = "media" + resourceMediaAttachment string = "media-attachment" + resourceMutedAccounts string = "muted-accounts" + resourceNote string = "note" + resourcePoll string = "poll" + resourceStatus string = "status" + resourceStar string = "star" + resourceStarred string = "starred" + resourceTimeline string = "timeline" + resourceVote string = "vote" +) diff --git a/internal/executor/create.go b/internal/executor/create.go index 9d5cd1e..a3d3e04 100644 --- a/internal/executor/create.go +++ b/internal/executor/create.go @@ -34,12 +34,12 @@ func (c *CreateExecutor) Execute() error { func (c *CreateExecutor) createList(gtsClient *client.Client) error { if c.listTitle == "" { - return FlagNotSetError{flagText: flagListTitle} + return Error{"please provide the title of the list that you want to create"} } parsedListRepliesPolicy, err := model.ParseListRepliesPolicy(c.listRepliesPolicy) if err != nil { - return err + return err //nolint:wrapcheck } form := client.CreateListForm{ diff --git a/internal/executor/flags.go b/internal/executor/flags.go deleted file mode 100644 index 93f1591..0000000 --- a/internal/executor/flags.go +++ /dev/null @@ -1,12 +0,0 @@ -package executor - -const ( - flagAttachmentID = "attachment-id" - flagContent = "content" - flagFrom = "from" - flagInstance = "instance" - flagListTitle = "list-title" - flagTag = "tag" - flagTo = "to" - flagType = "type" -) diff --git a/internal/executor/login.go b/internal/executor/login.go index 240be48..c226285 100644 --- a/internal/executor/login.go +++ b/internal/executor/login.go @@ -13,7 +13,7 @@ func (l *LoginExecutor) Execute() error { var err error if l.instance == "" { - return FlagNotSetError{flagText: flagInstance} + return Error{"please specify the instance that you want to log into"} } instance := l.instance diff --git a/internal/executor/resources.go b/internal/executor/resources.go deleted file mode 100644 index d60102a..0000000 --- a/internal/executor/resources.go +++ /dev/null @@ -1,25 +0,0 @@ -package executor - -const ( - resourceAccount = "account" - resourceBlocked = "blocked" - resourceBookmarks = "bookmarks" - resourceBoost = "boost" - resourceFollowers = "followers" - resourceFollowing = "following" - resourceFollowRequest = "follow-request" - resourceInstance = "instance" - resourceLike = "like" - resourceLiked = "liked" - resourceList = "list" - resourceMedia = "media" - resourceMediaAttachment = "media-attachment" - resourceMutedAccounts = "muted-accounts" - resourceNote = "note" - resourcePoll = "poll" - resourceStatus = "status" - resourceStar = "star" - resourceStarred = "starred" - resourceTimeline = "timeline" - resourceVote = "vote" -) diff --git a/internal/executor/show.go b/internal/executor/show.go index f645a50..8f7d42d 100644 --- a/internal/executor/show.go +++ b/internal/executor/show.go @@ -176,7 +176,7 @@ func (s *ShowExecutor) showTimeline(gtsClient *client.Client) error { timeline, err = gtsClient.GetListTimeline(list.ID, list.Title, s.limit) case model.TimelineCategoryTag: if s.tag == "" { - return FlagNotSetError{flagText: flagTag} + return Error{"please provide the name of the tag"} } timeline, err = gtsClient.GetTagTimeline(s.tag, s.limit) @@ -416,10 +416,6 @@ func (s *ShowExecutor) showMutedAccounts(gtsClient *client.Client) error { } func (s *ShowExecutor) showMediaAttachment(gtsClient *client.Client) error { - if len(s.attachmentIDs) == 0 { - return FlagNotSetError{flagText: flagAttachmentID} - } - if len(s.attachmentIDs) != 1 { return fmt.Errorf( "unexpected number of attachment IDs received: want 1, got %d",