Dan Anglin
c04cd7e8a5
Changes: - moved the command names from main to the executor package. - moved the unknownCommandError to the executor package and renamed it to UnknownCommandError. - define the command summaries within the executor package. - replace the switch statement in main.run() with a hashmap for looking up the corresponding executor to the given command. - transformed BlockExecutor to BlockOrUnblockExecutor. - transformed FollowExecutor to FollowOrUnfollowExecutor. Additional fixes: - fixed flag for the version executor.
60 lines
1.6 KiB
Go
60 lines
1.6 KiB
Go
// SPDX-FileCopyrightText: 2024 Dan Anglin <d.n.i.anglin@gmail.com>
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package executor
|
|
|
|
import "strings"
|
|
|
|
const (
|
|
flagAccountName = "account-name"
|
|
flagBrowser = "browser"
|
|
flagContentType = "content-type"
|
|
flagContent = "content"
|
|
flagEnableFederation = "enable-federation"
|
|
flagEnableLikes = "enable-likes"
|
|
flagEnableReplies = "enable-replies"
|
|
flagEnableReposts = "enable-reposts"
|
|
flagFrom = "from"
|
|
flagFromFile = "from-file"
|
|
flagFull = "full"
|
|
flagInstance = "instance"
|
|
flagLanguage = "language"
|
|
flagLimit = "limit"
|
|
flagListID = "list-id"
|
|
flagListTitle = "list-title"
|
|
flagListRepliesPolicy = "list-replies-policy"
|
|
flagMyAccount = "my-account"
|
|
flagNotify = "notify"
|
|
flagSensitive = "sensitive"
|
|
flagSkipRelationship = "skip-relationship"
|
|
flagShowPreferences = "show-preferences"
|
|
flagShowReposts = "show-reposts"
|
|
flagSpoilerText = "spoiler-text"
|
|
flagStatusID = "status-id"
|
|
flagTag = "tag"
|
|
flagTimelineCategory = "timeline-category"
|
|
flagTo = "to"
|
|
flagType = "type"
|
|
flagVisibility = "visibility"
|
|
)
|
|
|
|
type AccountNames []string
|
|
|
|
func (a *AccountNames) String() string {
|
|
return strings.Join(*a, ", ")
|
|
}
|
|
|
|
func (a *AccountNames) Set(value string) error {
|
|
if len(value) > 0 {
|
|
*a = append(*a, value)
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
type TopLevelFlags struct {
|
|
ConfigDir string
|
|
NoColor *bool
|
|
Pager string
|
|
}
|