// SPDX-FileCopyrightText: 2024 Dan Anglin // // SPDX-License-Identifier: GPL-3.0-or-later package executor import ( "fmt" "strconv" "strings" ) const ( flagAccountName = "account-name" flagBrowser = "browser" flagChoose = "choose" 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" flagPollID = "poll-id" 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 } type PollChoices []int func (p *PollChoices) String() string { value := "Choices: " for ind, vote := range *p { if ind == len(*p)-1 { value += strconv.Itoa(vote) } else { value += strconv.Itoa(vote) + ", " } } return value } func (p *PollChoices) Set(text string) error { value, err := strconv.Atoi(text) if err != nil { return fmt.Errorf("unable to parse the value to an integer: %w", err) } *p = append(*p, value) return nil }