refactor: clean up unused const
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
All checks were successful
REUSE Compliance Check / check (push) Successful in 5s
This commit is contained in:
parent
277bec49ef
commit
15b9761497
6 changed files with 33 additions and 45 deletions
29
internal/executor/consts.go
Normal file
29
internal/executor/consts.go
Normal file
|
@ -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"
|
||||||
|
)
|
|
@ -34,12 +34,12 @@ func (c *CreateExecutor) Execute() error {
|
||||||
|
|
||||||
func (c *CreateExecutor) createList(gtsClient *client.Client) error {
|
func (c *CreateExecutor) createList(gtsClient *client.Client) error {
|
||||||
if c.listTitle == "" {
|
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)
|
parsedListRepliesPolicy, err := model.ParseListRepliesPolicy(c.listRepliesPolicy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err //nolint:wrapcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
form := client.CreateListForm{
|
form := client.CreateListForm{
|
||||||
|
|
|
@ -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"
|
|
||||||
)
|
|
|
@ -13,7 +13,7 @@ func (l *LoginExecutor) Execute() error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if l.instance == "" {
|
if l.instance == "" {
|
||||||
return FlagNotSetError{flagText: flagInstance}
|
return Error{"please specify the instance that you want to log into"}
|
||||||
}
|
}
|
||||||
|
|
||||||
instance := l.instance
|
instance := l.instance
|
||||||
|
|
|
@ -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"
|
|
||||||
)
|
|
|
@ -176,7 +176,7 @@ func (s *ShowExecutor) showTimeline(gtsClient *client.Client) error {
|
||||||
timeline, err = gtsClient.GetListTimeline(list.ID, list.Title, s.limit)
|
timeline, err = gtsClient.GetListTimeline(list.ID, list.Title, s.limit)
|
||||||
case model.TimelineCategoryTag:
|
case model.TimelineCategoryTag:
|
||||||
if s.tag == "" {
|
if s.tag == "" {
|
||||||
return FlagNotSetError{flagText: flagTag}
|
return Error{"please provide the name of the tag"}
|
||||||
}
|
}
|
||||||
|
|
||||||
timeline, err = gtsClient.GetTagTimeline(s.tag, s.limit)
|
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 {
|
func (s *ShowExecutor) showMediaAttachment(gtsClient *client.Client) error {
|
||||||
if len(s.attachmentIDs) == 0 {
|
|
||||||
return FlagNotSetError{flagText: flagAttachmentID}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(s.attachmentIDs) != 1 {
|
if len(s.attachmentIDs) != 1 {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"unexpected number of attachment IDs received: want 1, got %d",
|
"unexpected number of attachment IDs received: want 1, got %d",
|
||||||
|
|
Loading…
Reference in a new issue