Compare commits
No commits in common. "7d2daf77cfd3ae4c5e84f6079f533814c550dc38" and "9d509af0df62179ee339a386c208851bfc745183" have entirely different histories.
7d2daf77cf
...
9d509af0df
10 changed files with 263 additions and 465 deletions
|
@ -36,11 +36,10 @@ func main() {
|
||||||
|
|
||||||
func generateExecutors(schema enbasCLISchema, output string) error {
|
func generateExecutors(schema enbasCLISchema, output string) error {
|
||||||
funcMap := template.FuncMap{
|
funcMap := template.FuncMap{
|
||||||
"capitalise": capitalise,
|
"capitalise": capitalise,
|
||||||
"flagFieldName": flagFieldName,
|
"flagFieldName": flagFieldName,
|
||||||
"getFlagType": schema.Flags.getType,
|
"getFlagType": schema.Flags.getType,
|
||||||
"getFlagDescription": schema.Flags.getDescription,
|
"getFlagDescription": schema.Flags.getDescription,
|
||||||
"customFlagValueType": customFlagValueType,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl := template.Must(template.New("executor-template").Funcs(funcMap).Parse(executorsFileTemplate))
|
tmpl := template.Must(template.New("executor-template").Funcs(funcMap).Parse(executorsFileTemplate))
|
||||||
|
@ -108,16 +107,3 @@ func convertFlagToMixedCaps(value string) string {
|
||||||
|
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func customFlagValueType(flagType string) bool {
|
|
||||||
customFlagValueTypes := map[string]struct{}{
|
|
||||||
"MultiStringFlagValue": {},
|
|
||||||
"MultiIntFlagValue": {},
|
|
||||||
"TimeDurationFlagValue": {},
|
|
||||||
"BoolPtrFlagValue": {},
|
|
||||||
}
|
|
||||||
|
|
||||||
_, exists := customFlagValueTypes[flagType]
|
|
||||||
|
|
||||||
return exists
|
|
||||||
}
|
|
||||||
|
|
|
@ -51,13 +51,6 @@ func {{ $new_executor_function_name }}(
|
||||||
{{- if $command.UseConfig }}
|
{{- if $command.UseConfig }}
|
||||||
config: config,
|
config: config,
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range $flag := $command.Flags -}}
|
|
||||||
{{- $flag_type := getFlagType $flag.Flag -}}
|
|
||||||
{{- if customFlagValueType $flag_type -}}
|
|
||||||
{{ print "" }}
|
|
||||||
{{ flagFieldName $flag }}: New{{ $flag_type }}(),
|
|
||||||
{{- end -}}
|
|
||||||
{{- end -}}
|
|
||||||
{{- range $field := $command.AdditionalFields -}}
|
{{- range $field := $command.AdditionalFields -}}
|
||||||
{{ print "" }}
|
{{ print "" }}
|
||||||
{{ $field.Name }}: {{ $field.Name }},
|
{{ $field.Name }}: {{ $field.Name }},
|
||||||
|
@ -68,16 +61,12 @@ func {{ $new_executor_function_name }}(
|
||||||
exe.Usage = commandUsageFunc({{ printf "%q" $name }}, {{ printf "%q" $command.Summary }}, exe.FlagSet)
|
exe.Usage = commandUsageFunc({{ printf "%q" $name }}, {{ printf "%q" $command.Summary }}, exe.FlagSet)
|
||||||
{{ print "" }}
|
{{ print "" }}
|
||||||
{{- range $flag := $command.Flags -}}
|
{{- range $flag := $command.Flags -}}
|
||||||
{{- $flag_type := getFlagType $flag.Flag -}}
|
{{- if eq (getFlagType $flag.Flag) "string" -}}
|
||||||
{{- if eq $flag_type "string" -}}
|
|
||||||
{{ print "" }}
|
{{ print "" }}
|
||||||
exe.StringVar(&exe.{{ flagFieldName $flag }}, {{ printf "%q" $flag.Flag }}, {{ printf "%q" $flag.Default }}, {{ getFlagDescription $flag.Flag | printf "%q" }})
|
exe.StringVar(&exe.{{ flagFieldName $flag }}, {{ printf "%q" $flag.Flag }}, {{ printf "%q" $flag.Default }}, {{ getFlagDescription $flag.Flag | printf "%q" }})
|
||||||
{{- else if eq $flag_type "bool" -}}
|
{{- else if eq (getFlagType $flag.Flag) "bool" -}}
|
||||||
{{ print "" }}
|
{{ print "" }}
|
||||||
exe.BoolVar(&exe.{{ flagFieldName $flag }}, {{ printf "%q" $flag.Flag }}, {{ $flag.Default }}, {{ getFlagDescription $flag.Flag | printf "%q" }})
|
exe.BoolVar(&exe.{{ flagFieldName $flag }}, {{ printf "%q" $flag.Flag }}, {{ $flag.Default }}, {{ getFlagDescription $flag.Flag | printf "%q" }})
|
||||||
{{- else if customFlagValueType $flag_type -}}
|
|
||||||
{{ print "" }}
|
|
||||||
exe.Var(&exe.{{ flagFieldName $flag }}, {{ printf "%q" $flag.Flag }}, {{ getFlagDescription $flag.Flag | printf "%q" }})
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ print "" }}
|
{{ print "" }}
|
||||||
|
|
|
@ -106,6 +106,8 @@ func run() error {
|
||||||
executor.CommandCreate: executor.NewCreateExecutor(
|
executor.CommandCreate: executor.NewCreateExecutor(
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
enbasConfig,
|
enbasConfig,
|
||||||
|
executor.CommandCreate,
|
||||||
|
executor.CommandSummaryLookup(executor.CommandCreate),
|
||||||
),
|
),
|
||||||
executor.CommandDelete: executor.NewDeleteExecutor(
|
executor.CommandDelete: executor.NewDeleteExecutor(
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
|
@ -127,9 +129,11 @@ func run() error {
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
enbasConfig,
|
enbasConfig,
|
||||||
),
|
),
|
||||||
executor.CommandMute: executor.NewMuteExecutor(
|
executor.CommandMute: executor.NewMuteOrUnmuteExecutor(
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
enbasConfig,
|
enbasConfig,
|
||||||
|
executor.CommandMute,
|
||||||
|
executor.CommandSummaryLookup(executor.CommandMute),
|
||||||
),
|
),
|
||||||
executor.CommandReject: executor.NewRejectExecutor(
|
executor.CommandReject: executor.NewRejectExecutor(
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
|
@ -149,9 +153,11 @@ func run() error {
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
enbasConfig,
|
enbasConfig,
|
||||||
),
|
),
|
||||||
executor.CommandUnmute: executor.NewUnmuteExecutor(
|
executor.CommandUnmute: executor.NewMuteOrUnmuteExecutor(
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
enbasConfig,
|
enbasConfig,
|
||||||
|
executor.CommandUnmute,
|
||||||
|
executor.CommandSummaryLookup(executor.CommandUnmute),
|
||||||
),
|
),
|
||||||
executor.CommandUnblock: executor.NewUnblockExecutor(
|
executor.CommandUnblock: executor.NewUnblockExecutor(
|
||||||
enbasPrinter,
|
enbasPrinter,
|
||||||
|
|
|
@ -1,13 +1,94 @@
|
||||||
package executor
|
package executor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"codeflow.dananglin.me.uk/apollo/enbas/internal/client"
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/client"
|
||||||
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/config"
|
||||||
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/model"
|
||||||
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/printer"
|
||||||
"codeflow.dananglin.me.uk/apollo/enbas/internal/utilities"
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/utilities"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type CreateExecutor struct {
|
||||||
|
*flag.FlagSet
|
||||||
|
|
||||||
|
printer *printer.Printer
|
||||||
|
config *config.Config
|
||||||
|
addPoll bool
|
||||||
|
boostable bool
|
||||||
|
federated bool
|
||||||
|
likeable bool
|
||||||
|
pollAllowsMultipleChoices bool
|
||||||
|
pollHidesVoteCounts bool
|
||||||
|
replyable bool
|
||||||
|
sensitive *bool
|
||||||
|
content string
|
||||||
|
contentType string
|
||||||
|
fromFile string
|
||||||
|
inReplyTo string
|
||||||
|
language string
|
||||||
|
resourceType string
|
||||||
|
listTitle string
|
||||||
|
listRepliesPolicy string
|
||||||
|
spoilerText string
|
||||||
|
visibility string
|
||||||
|
pollExpiresIn TimeDurationFlagValue
|
||||||
|
pollOptions MultiStringFlagValue
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCreateExecutor(printer *printer.Printer, config *config.Config, name, summary string) *CreateExecutor {
|
||||||
|
createExe := CreateExecutor{
|
||||||
|
FlagSet: flag.NewFlagSet(name, flag.ExitOnError),
|
||||||
|
|
||||||
|
printer: printer,
|
||||||
|
config: config,
|
||||||
|
}
|
||||||
|
|
||||||
|
createExe.StringVar(&createExe.resourceType, flagType, "", "Specify the type of resource to create")
|
||||||
|
|
||||||
|
// Flags for statuses
|
||||||
|
createExe.BoolVar(&createExe.boostable, flagEnableReposts, true, "Specify if the status can be reposted/boosted by others")
|
||||||
|
createExe.StringVar(&createExe.content, flagContent, "", "The content of the status to create")
|
||||||
|
createExe.StringVar(&createExe.contentType, flagContentType, "plain", "The type that the contents should be parsed from (valid values are plain and markdown)")
|
||||||
|
createExe.BoolVar(&createExe.federated, flagEnableFederation, true, "Specify if the status can be federated beyond the local timelines")
|
||||||
|
createExe.StringVar(&createExe.fromFile, flagFromFile, "", "The file path where to read the contents from")
|
||||||
|
createExe.StringVar(&createExe.inReplyTo, flagInReplyTo, "", "The ID of the status that you want to reply to")
|
||||||
|
createExe.StringVar(&createExe.language, flagLanguage, "", "The ISO 639 language code for this status")
|
||||||
|
createExe.BoolVar(&createExe.likeable, flagEnableLikes, true, "Specify if the status can be liked/favourited")
|
||||||
|
createExe.BoolVar(&createExe.replyable, flagEnableReplies, true, "Specify if the status can be replied to")
|
||||||
|
createExe.StringVar(&createExe.spoilerText, flagSpoilerText, "", "The text to display as the status' warning or subject")
|
||||||
|
createExe.StringVar(&createExe.visibility, flagVisibility, "", "The visibility of the posted status")
|
||||||
|
createExe.BoolFunc(flagSensitive, "Specify if the status should be marked as sensitive", func(value string) error {
|
||||||
|
boolVal, err := strconv.ParseBool(value)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to parse %q as a boolean value: %w", value, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
createExe.sensitive = new(bool)
|
||||||
|
*createExe.sensitive = boolVal
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
// Flags specifically for polls
|
||||||
|
createExe.BoolVar(&createExe.addPoll, flagAddPoll, false, "Add a poll to the status")
|
||||||
|
createExe.BoolVar(&createExe.pollAllowsMultipleChoices, flagPollAllowsMultipleChoices, false, "The poll allows viewers to make multiple choices in the poll")
|
||||||
|
createExe.BoolVar(&createExe.pollHidesVoteCounts, flagPollHidesVoteCounts, false, "The poll will hide the vote count until it is closed")
|
||||||
|
createExe.Var(&createExe.pollOptions, flagPollOption, "A poll option. Use this multiple times to set multiple options")
|
||||||
|
createExe.Var(&createExe.pollExpiresIn, flagPollExpiresIn, "The duration in which the poll is open for")
|
||||||
|
|
||||||
|
// Flags for lists
|
||||||
|
createExe.StringVar(&createExe.listTitle, flagListTitle, "", "Specify the title of the list")
|
||||||
|
createExe.StringVar(&createExe.listRepliesPolicy, flagListRepliesPolicy, "list", "Specify the policy of the replies for this list (valid values are followed, list and none)")
|
||||||
|
|
||||||
|
createExe.Usage = commandUsageFunc(name, summary, createExe.FlagSet)
|
||||||
|
|
||||||
|
return &createExe
|
||||||
|
}
|
||||||
|
|
||||||
func (c *CreateExecutor) Execute() error {
|
func (c *CreateExecutor) Execute() error {
|
||||||
if c.resourceType == "" {
|
if c.resourceType == "" {
|
||||||
return FlagNotSetError{flagText: flagType}
|
return FlagNotSetError{flagText: flagType}
|
||||||
|
@ -98,8 +179,8 @@ func (c *CreateExecutor) createStatus(gtsClient *client.Client) error {
|
||||||
visibility = preferences.PostingDefaultVisibility
|
visibility = preferences.PostingDefaultVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.sensitive.Value != nil {
|
if c.sensitive != nil {
|
||||||
sensitive = *c.sensitive.Value
|
sensitive = *c.sensitive
|
||||||
} else {
|
} else {
|
||||||
sensitive = preferences.PostingDefaultSensitive
|
sensitive = preferences.PostingDefaultSensitive
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,71 +64,6 @@ func NewBlockExecutor(
|
||||||
return &exe
|
return &exe
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateExecutor is the executor for the create command.
|
|
||||||
type CreateExecutor struct {
|
|
||||||
*flag.FlagSet
|
|
||||||
printer *printer.Printer
|
|
||||||
config *config.Config
|
|
||||||
addPoll bool
|
|
||||||
content string
|
|
||||||
contentType string
|
|
||||||
federated bool
|
|
||||||
likeable bool
|
|
||||||
replyable bool
|
|
||||||
boostable bool
|
|
||||||
fromFile string
|
|
||||||
inReplyTo string
|
|
||||||
language string
|
|
||||||
listRepliesPolicy string
|
|
||||||
listTitle string
|
|
||||||
pollAllowsMultipleChoices bool
|
|
||||||
pollExpiresIn TimeDurationFlagValue
|
|
||||||
pollHidesVoteCounts bool
|
|
||||||
pollOptions MultiStringFlagValue
|
|
||||||
sensitive BoolPtrFlagValue
|
|
||||||
spoilerText string
|
|
||||||
resourceType string
|
|
||||||
visibility string
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewCreateExecutor(
|
|
||||||
printer *printer.Printer,
|
|
||||||
config *config.Config,
|
|
||||||
) *CreateExecutor {
|
|
||||||
exe := CreateExecutor{
|
|
||||||
FlagSet: flag.NewFlagSet("create", flag.ExitOnError),
|
|
||||||
printer: printer,
|
|
||||||
config: config,
|
|
||||||
pollExpiresIn: NewTimeDurationFlagValue(),
|
|
||||||
pollOptions: NewMultiStringFlagValue(),
|
|
||||||
sensitive: NewBoolPtrFlagValue(),
|
|
||||||
}
|
|
||||||
|
|
||||||
exe.Usage = commandUsageFunc("create", "Creates a specific resource", exe.FlagSet)
|
|
||||||
|
|
||||||
exe.BoolVar(&exe.addPoll, "add-poll", false, "Set to true to add a poll when creating a status")
|
|
||||||
exe.StringVar(&exe.content, "content", "", "The content of the created resource")
|
|
||||||
exe.StringVar(&exe.contentType, "content-type", "plain", "The type that the contents should be parsed from (valid values are plain and markdown)")
|
|
||||||
exe.BoolVar(&exe.federated, "enable-federation", true, "Set to true to federate the status beyond the local timelines")
|
|
||||||
exe.BoolVar(&exe.likeable, "enable-likes", true, "Set to true to allow the status to be liked (favourited)")
|
|
||||||
exe.BoolVar(&exe.replyable, "enable-replies", true, "Set to true to allow viewers to reply to the status")
|
|
||||||
exe.BoolVar(&exe.boostable, "enable-reposts", true, "Set to true to allow the status to be reposted (boosted) by others")
|
|
||||||
exe.StringVar(&exe.fromFile, "from-file", "", "The file path where to read the contents from")
|
|
||||||
exe.StringVar(&exe.inReplyTo, "in-reply-to", "", "The ID of the status that you want to reply to")
|
|
||||||
exe.StringVar(&exe.language, "language", "", "The ISO 639 language code for this status")
|
|
||||||
exe.StringVar(&exe.listRepliesPolicy, "list-replies-policy", "list", "The replies policy of the list")
|
|
||||||
exe.StringVar(&exe.listTitle, "list-title", "", "The title of the list")
|
|
||||||
exe.BoolVar(&exe.pollAllowsMultipleChoices, "poll-allows-multiple-choices", false, "Set to true to allow viewers to make multiple choices in the poll")
|
|
||||||
exe.Var(&exe.pollExpiresIn, "poll-expires-in", "The duration in which the poll is open for")
|
|
||||||
exe.BoolVar(&exe.pollHidesVoteCounts, "poll-hides-vote-counts", false, "Set to true to hide the vote count until the poll is closed")
|
|
||||||
exe.Var(&exe.pollOptions, "poll-option", "A poll option. Use this multiple times to set multiple options")
|
|
||||||
exe.Var(&exe.sensitive, "sensitive", "Set to true if the status should be marked as sensitive")
|
|
||||||
exe.StringVar(&exe.spoilerText, "spoiler-text", "", "The text to display as the status' warning or subject")
|
|
||||||
exe.StringVar(&exe.resourceType, "type", "", "The type of resource you want to action on (e.g. account, status)")
|
|
||||||
exe.StringVar(&exe.visibility, "visibility", "", "The visibility of the posted status")
|
|
||||||
return &exe
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeleteExecutor is the executor for the delete command.
|
// DeleteExecutor is the executor for the delete command.
|
||||||
type DeleteExecutor struct {
|
type DeleteExecutor struct {
|
||||||
*flag.FlagSet
|
*flag.FlagSet
|
||||||
|
@ -148,7 +83,7 @@ func NewDeleteExecutor(
|
||||||
config: config,
|
config: config,
|
||||||
}
|
}
|
||||||
|
|
||||||
exe.Usage = commandUsageFunc("delete", "Deletes a specific resource", exe.FlagSet)
|
exe.Usage = commandUsageFunc("delete", "Delete a specific resource", exe.FlagSet)
|
||||||
|
|
||||||
exe.StringVar(&exe.listID, "list-id", "", "The ID of the list in question")
|
exe.StringVar(&exe.listID, "list-id", "", "The ID of the list in question")
|
||||||
exe.StringVar(&exe.resourceType, "type", "", "The type of resource you want to action on (e.g. account, status)")
|
exe.StringVar(&exe.resourceType, "type", "", "The type of resource you want to action on (e.g. account, status)")
|
||||||
|
@ -261,37 +196,6 @@ func NewLoginExecutor(
|
||||||
return &exe
|
return &exe
|
||||||
}
|
}
|
||||||
|
|
||||||
// MuteExecutor is the executor for the mute command.
|
|
||||||
type MuteExecutor struct {
|
|
||||||
*flag.FlagSet
|
|
||||||
printer *printer.Printer
|
|
||||||
config *config.Config
|
|
||||||
accountName string
|
|
||||||
muteDuration TimeDurationFlagValue
|
|
||||||
muteNotifications bool
|
|
||||||
resourceType string
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewMuteExecutor(
|
|
||||||
printer *printer.Printer,
|
|
||||||
config *config.Config,
|
|
||||||
) *MuteExecutor {
|
|
||||||
exe := MuteExecutor{
|
|
||||||
FlagSet: flag.NewFlagSet("mute", flag.ExitOnError),
|
|
||||||
printer: printer,
|
|
||||||
config: config,
|
|
||||||
muteDuration: NewTimeDurationFlagValue(),
|
|
||||||
}
|
|
||||||
|
|
||||||
exe.Usage = commandUsageFunc("mute", "Mutes a specific resource (e.g. an account)", exe.FlagSet)
|
|
||||||
|
|
||||||
exe.StringVar(&exe.accountName, "account-name", "", "The name of the account")
|
|
||||||
exe.Var(&exe.muteDuration, "mute-duration", "Specify how long the mute should last for. To mute indefinitely, set this to 0s")
|
|
||||||
exe.BoolVar(&exe.muteNotifications, "mute-notifications", false, "Set to true to mute notifications as well as posts")
|
|
||||||
exe.StringVar(&exe.resourceType, "type", "", "The type of resource you want to action on (e.g. account, status)")
|
|
||||||
return &exe
|
|
||||||
}
|
|
||||||
|
|
||||||
// RejectExecutor is the executor for the reject command.
|
// RejectExecutor is the executor for the reject command.
|
||||||
type RejectExecutor struct {
|
type RejectExecutor struct {
|
||||||
*flag.FlagSet
|
*flag.FlagSet
|
||||||
|
@ -396,32 +300,6 @@ func NewUnfollowExecutor(
|
||||||
return &exe
|
return &exe
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmuteExecutor is the executor for the unmute command.
|
|
||||||
type UnmuteExecutor struct {
|
|
||||||
*flag.FlagSet
|
|
||||||
printer *printer.Printer
|
|
||||||
config *config.Config
|
|
||||||
accountName string
|
|
||||||
resourceType string
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewUnmuteExecutor(
|
|
||||||
printer *printer.Printer,
|
|
||||||
config *config.Config,
|
|
||||||
) *UnmuteExecutor {
|
|
||||||
exe := UnmuteExecutor{
|
|
||||||
FlagSet: flag.NewFlagSet("unmute", flag.ExitOnError),
|
|
||||||
printer: printer,
|
|
||||||
config: config,
|
|
||||||
}
|
|
||||||
|
|
||||||
exe.Usage = commandUsageFunc("unmute", "Umutes a specific resource (e.g. an account)", exe.FlagSet)
|
|
||||||
|
|
||||||
exe.StringVar(&exe.accountName, "account-name", "", "The name of the account")
|
|
||||||
exe.StringVar(&exe.resourceType, "type", "", "The type of resource you want to action on (e.g. account, status)")
|
|
||||||
return &exe
|
|
||||||
}
|
|
||||||
|
|
||||||
// VersionExecutor is the executor for the version command.
|
// VersionExecutor is the executor for the version command.
|
||||||
type VersionExecutor struct {
|
type VersionExecutor struct {
|
||||||
*flag.FlagSet
|
*flag.FlagSet
|
||||||
|
|
|
@ -8,47 +8,58 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
flagAccountName = "account-name"
|
flagAddPoll = "add-poll"
|
||||||
flagAllImages = "all-images"
|
flagAccountName = "account-name"
|
||||||
flagAllVideos = "all-videos"
|
flagAllImages = "all-images"
|
||||||
flagAttachmentID = "attachment-id"
|
flagAllVideos = "all-videos"
|
||||||
flagBrowser = "browser"
|
flagAttachmentID = "attachment-id"
|
||||||
flagContent = "content"
|
flagBrowser = "browser"
|
||||||
flagExcludeBoosts = "exclude-boosts"
|
flagContentType = "content-type"
|
||||||
flagExcludeReplies = "exclude-replies"
|
flagContent = "content"
|
||||||
flagFrom = "from"
|
flagEnableFederation = "enable-federation"
|
||||||
flagFromFile = "from-file"
|
flagEnableLikes = "enable-likes"
|
||||||
flagInstance = "instance"
|
flagEnableReplies = "enable-replies"
|
||||||
flagLimit = "limit"
|
flagEnableReposts = "enable-reposts"
|
||||||
flagListID = "list-id"
|
flagExcludeBoosts = "exclude-boosts"
|
||||||
flagListTitle = "list-title"
|
flagExcludeReplies = "exclude-replies"
|
||||||
flagMyAccount = "my-account"
|
flagFrom = "from"
|
||||||
flagOnlyMedia = "only-media"
|
flagFromFile = "from-file"
|
||||||
flagOnlyPinned = "only-pinned"
|
flagInReplyTo = "in-reply-to"
|
||||||
flagOnlyPublic = "only-public"
|
flagInstance = "instance"
|
||||||
flagPollID = "poll-id"
|
flagLanguage = "language"
|
||||||
flagPollOption = "poll-option"
|
flagLimit = "limit"
|
||||||
flagSkipRelationship = "skip-relationship"
|
flagListID = "list-id"
|
||||||
flagShowPreferences = "show-preferences"
|
flagListTitle = "list-title"
|
||||||
flagShowStatuses = "show-statuses"
|
flagListRepliesPolicy = "list-replies-policy"
|
||||||
flagStatusID = "status-id"
|
flagMyAccount = "my-account"
|
||||||
flagTag = "tag"
|
flagMuteDuration = "mute-duration"
|
||||||
flagTimelineCategory = "timeline-category"
|
flagMuteNotifications = "mute-notifications"
|
||||||
flagTo = "to"
|
flagOnlyMedia = "only-media"
|
||||||
flagType = "type"
|
flagOnlyPinned = "only-pinned"
|
||||||
flagVote = "vote"
|
flagOnlyPublic = "only-public"
|
||||||
|
flagPollAllowsMultipleChoices = "poll-allows-multiple-choices"
|
||||||
|
flagPollExpiresIn = "poll-expires-in"
|
||||||
|
flagPollHidesVoteCounts = "poll-hides-vote-counts"
|
||||||
|
flagPollID = "poll-id"
|
||||||
|
flagPollOption = "poll-option"
|
||||||
|
flagSensitive = "sensitive"
|
||||||
|
flagSkipRelationship = "skip-relationship"
|
||||||
|
flagShowPreferences = "show-preferences"
|
||||||
|
flagShowStatuses = "show-statuses"
|
||||||
|
flagSpoilerText = "spoiler-text"
|
||||||
|
flagStatusID = "status-id"
|
||||||
|
flagTag = "tag"
|
||||||
|
flagTimelineCategory = "timeline-category"
|
||||||
|
flagTo = "to"
|
||||||
|
flagType = "type"
|
||||||
|
flagVisibility = "visibility"
|
||||||
|
flagVote = "vote"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MultiStringFlagValue []string
|
type MultiStringFlagValue []string
|
||||||
|
|
||||||
func NewMultiStringFlagValue() MultiStringFlagValue {
|
func (v *MultiStringFlagValue) String() string {
|
||||||
arr := make([]string, 0, 3)
|
return strings.Join(*v, ", ")
|
||||||
|
|
||||||
return MultiStringFlagValue(arr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v MultiStringFlagValue) String() string {
|
|
||||||
return strings.Join(v, ", ")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *MultiStringFlagValue) Set(value string) error {
|
func (v *MultiStringFlagValue) Set(value string) error {
|
||||||
|
@ -61,17 +72,11 @@ func (v *MultiStringFlagValue) Set(value string) error {
|
||||||
|
|
||||||
type MultiIntFlagValue []int
|
type MultiIntFlagValue []int
|
||||||
|
|
||||||
func NewMultiIntFlagValue() MultiIntFlagValue {
|
func (v *MultiIntFlagValue) String() string {
|
||||||
arr := make([]int, 0, 3)
|
|
||||||
|
|
||||||
return MultiIntFlagValue(arr)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v MultiIntFlagValue) String() string {
|
|
||||||
value := "Choices: "
|
value := "Choices: "
|
||||||
|
|
||||||
for ind, vote := range v {
|
for ind, vote := range *v {
|
||||||
if ind == len(v)-1 {
|
if ind == len(*v)-1 {
|
||||||
value += strconv.Itoa(vote)
|
value += strconv.Itoa(vote)
|
||||||
} else {
|
} else {
|
||||||
value += strconv.Itoa(vote) + ", "
|
value += strconv.Itoa(vote) + ", "
|
||||||
|
@ -96,14 +101,8 @@ type TimeDurationFlagValue struct {
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTimeDurationFlagValue() TimeDurationFlagValue {
|
|
||||||
return TimeDurationFlagValue{
|
|
||||||
Duration: 0 * time.Second,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v TimeDurationFlagValue) String() string {
|
func (v TimeDurationFlagValue) String() string {
|
||||||
return "Time duration: " + v.Duration.String()
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *TimeDurationFlagValue) Set(text string) error {
|
func (v *TimeDurationFlagValue) Set(text string) error {
|
||||||
|
@ -116,33 +115,3 @@ func (v *TimeDurationFlagValue) Set(text string) error {
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type BoolPtrFlagValue struct {
|
|
||||||
Value *bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewBoolPtrFlagValue() BoolPtrFlagValue {
|
|
||||||
return BoolPtrFlagValue{
|
|
||||||
Value: nil,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b BoolPtrFlagValue) String() string {
|
|
||||||
if b.Value == nil {
|
|
||||||
return "NOT SET"
|
|
||||||
}
|
|
||||||
|
|
||||||
return strconv.FormatBool(*b.Value)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BoolPtrFlagValue) Set(value string) error {
|
|
||||||
boolVar, err := strconv.ParseBool(value)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to parse %q as a boolean value: %w", value, err)
|
|
||||||
}
|
|
||||||
|
|
||||||
b.Value = new(bool)
|
|
||||||
*b.Value = boolVar
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
package executor
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"codeflow.dananglin.me.uk/apollo/enbas/internal/client"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (m *MuteExecutor) Execute() error {
|
|
||||||
funcMap := map[string]func(*client.Client) error{
|
|
||||||
resourceAccount: m.muteAccount,
|
|
||||||
}
|
|
||||||
|
|
||||||
doFunc, ok := funcMap[m.resourceType]
|
|
||||||
if !ok {
|
|
||||||
return UnsupportedTypeError{resourceType: m.resourceType}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtsClient, err := client.NewClientFromFile(m.config.CredentialsFile)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to create the GoToSocial client: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return doFunc(gtsClient)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *MuteExecutor) muteAccount(gtsClient *client.Client) error {
|
|
||||||
if m.accountName == "" {
|
|
||||||
return FlagNotSetError{flagText: flagAccountName}
|
|
||||||
}
|
|
||||||
|
|
||||||
accountID, err := getAccountID(gtsClient, false, m.accountName, m.config.CredentialsFile)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
form := client.MuteAccountForm{
|
|
||||||
Notifications: m.muteNotifications,
|
|
||||||
Duration: int(m.muteDuration.Duration.Seconds()),
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := gtsClient.MuteAccount(accountID, form); err != nil {
|
|
||||||
return fmt.Errorf("unable to mute the account: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
m.printer.PrintSuccess("Successfully muted the account.")
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
108
internal/executor/mute_or_unmute.go
Normal file
108
internal/executor/mute_or_unmute.go
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
package executor
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/client"
|
||||||
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/config"
|
||||||
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/printer"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MuteOrUnmuteExecutor struct {
|
||||||
|
*flag.FlagSet
|
||||||
|
|
||||||
|
printer *printer.Printer
|
||||||
|
config *config.Config
|
||||||
|
accountName string
|
||||||
|
command string
|
||||||
|
resourceType string
|
||||||
|
muteDuration TimeDurationFlagValue
|
||||||
|
muteNotifications bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMuteOrUnmuteExecutor(printer *printer.Printer, config *config.Config, name, summary string) *MuteOrUnmuteExecutor {
|
||||||
|
muteDuration := TimeDurationFlagValue{time.Duration(0 * time.Second)}
|
||||||
|
|
||||||
|
exe := MuteOrUnmuteExecutor{
|
||||||
|
FlagSet: flag.NewFlagSet(name, flag.ExitOnError),
|
||||||
|
|
||||||
|
printer: printer,
|
||||||
|
config: config,
|
||||||
|
command: name,
|
||||||
|
muteDuration: muteDuration,
|
||||||
|
}
|
||||||
|
|
||||||
|
exe.StringVar(&exe.accountName, flagAccountName, "", "Specify the account name in full (username@domain)")
|
||||||
|
exe.StringVar(&exe.resourceType, flagType, "", "Specify the type of resource to mute or unmute")
|
||||||
|
exe.BoolVar(&exe.muteNotifications, flagMuteNotifications, false, "Mute notifications as well as posts")
|
||||||
|
exe.Var(&exe.muteDuration, flagMuteDuration, "Specify how long the mute should last for. To mute indefinitely, set this to 0s")
|
||||||
|
|
||||||
|
exe.Usage = commandUsageFunc(name, summary, exe.FlagSet)
|
||||||
|
|
||||||
|
return &exe
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MuteOrUnmuteExecutor) Execute() error {
|
||||||
|
funcMap := map[string]func(*client.Client) error{
|
||||||
|
resourceAccount: m.muteOrUnmuteAccount,
|
||||||
|
}
|
||||||
|
|
||||||
|
doFunc, ok := funcMap[m.resourceType]
|
||||||
|
if !ok {
|
||||||
|
return UnsupportedTypeError{resourceType: m.resourceType}
|
||||||
|
}
|
||||||
|
|
||||||
|
gtsClient, err := client.NewClientFromFile(m.config.CredentialsFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("unable to create the GoToSocial client: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return doFunc(gtsClient)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MuteOrUnmuteExecutor) muteOrUnmuteAccount(gtsClient *client.Client) error {
|
||||||
|
if m.accountName == "" {
|
||||||
|
return FlagNotSetError{flagText: flagAccountName}
|
||||||
|
}
|
||||||
|
|
||||||
|
accountID, err := getAccountID(gtsClient, false, m.accountName, m.config.CredentialsFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch m.command {
|
||||||
|
case CommandMute:
|
||||||
|
return m.muteAccount(gtsClient, accountID)
|
||||||
|
case CommandUnmute:
|
||||||
|
return m.unmuteAccount(gtsClient, accountID)
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MuteOrUnmuteExecutor) muteAccount(gtsClient *client.Client, accountID string) error {
|
||||||
|
form := client.MuteAccountForm{
|
||||||
|
Notifications: m.muteNotifications,
|
||||||
|
Duration: int(m.muteDuration.Duration.Seconds()),
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := gtsClient.MuteAccount(accountID, form); err != nil {
|
||||||
|
return fmt.Errorf("unable to mute the account: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.printer.PrintSuccess("Successfully muted the account.")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MuteOrUnmuteExecutor) unmuteAccount(gtsClient *client.Client, accountID string) error {
|
||||||
|
if err := gtsClient.UnmuteAccount(accountID); err != nil {
|
||||||
|
return fmt.Errorf("unable to unmute the account: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
m.printer.PrintSuccess("Successfully unmuted the account.")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -1,44 +0,0 @@
|
||||||
package executor
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"codeflow.dananglin.me.uk/apollo/enbas/internal/client"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (m *UnmuteExecutor) Execute() error {
|
|
||||||
funcMap := map[string]func(*client.Client) error{
|
|
||||||
resourceAccount: m.unmuteAccount,
|
|
||||||
}
|
|
||||||
|
|
||||||
doFunc, ok := funcMap[m.resourceType]
|
|
||||||
if !ok {
|
|
||||||
return UnsupportedTypeError{resourceType: m.resourceType}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtsClient, err := client.NewClientFromFile(m.config.CredentialsFile)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unable to create the GoToSocial client: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return doFunc(gtsClient)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *UnmuteExecutor) unmuteAccount(gtsClient *client.Client) error {
|
|
||||||
if m.accountName == "" {
|
|
||||||
return FlagNotSetError{flagText: flagAccountName}
|
|
||||||
}
|
|
||||||
|
|
||||||
accountID, err := getAccountID(gtsClient, false, m.accountName, m.config.CredentialsFile)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("received an error while getting the account ID: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := gtsClient.UnmuteAccount(accountID); err != nil {
|
|
||||||
return fmt.Errorf("unable to unmute the account: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
m.printer.PrintSuccess("Successfully unmuted the account.")
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
|
@ -4,106 +4,34 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The name of the account"
|
"description": "The name of the account"
|
||||||
},
|
},
|
||||||
"add-poll": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to add a poll when creating a status"
|
|
||||||
},
|
|
||||||
"content": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The content of the created resource"
|
|
||||||
},
|
|
||||||
"content-type": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The type that the contents should be parsed from (valid values are plain and markdown)"
|
|
||||||
},
|
|
||||||
"enable-federation": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to federate the status beyond the local timelines"
|
|
||||||
},
|
|
||||||
"enable-likes": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to allow the status to be liked (favourited)"
|
|
||||||
},
|
|
||||||
"enable-replies": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to allow viewers to reply to the status"
|
|
||||||
},
|
|
||||||
"enable-reposts": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to allow the status to be reposted (boosted) by others"
|
|
||||||
},
|
|
||||||
"from-file": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The file path where to read the contents from"
|
|
||||||
},
|
|
||||||
"full": {
|
"full": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"description": "Set to true to print the build information in full"
|
"description": "Set to true to print the build information in full"
|
||||||
},
|
},
|
||||||
"in-reply-to": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The ID of the status that you want to reply to"
|
|
||||||
},
|
|
||||||
"instance": {
|
"instance": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The instance that you want to log into"
|
"description": "The instance that you want to log into"
|
||||||
},
|
},
|
||||||
"language": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The ISO 639 language code for this status"
|
|
||||||
},
|
|
||||||
"list-id": {
|
"list-id": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The ID of the list in question"
|
"description": "The ID of the list in question"
|
||||||
},
|
},
|
||||||
"list-title": {
|
"list-title": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The title of the list"
|
"description": "The title of the list"
|
||||||
},
|
},
|
||||||
"list-replies-policy": {
|
"list-replies-policy": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The replies policy of the list"
|
"description": "The replies policy of the list"
|
||||||
},
|
|
||||||
"mute-duration": {
|
|
||||||
"type": "TimeDurationFlagValue",
|
|
||||||
"description": "Specify how long the mute should last for. To mute indefinitely, set this to 0s"
|
|
||||||
},
|
|
||||||
"mute-notifications": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to mute notifications as well as posts"
|
|
||||||
},
|
},
|
||||||
"notify": {
|
"notify": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"description": "Get notifications from statuses from the account you want to follow"
|
"description": "Get notifications from statuses from the account you want to follow"
|
||||||
},
|
},
|
||||||
"poll-allows-multiple-choices": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to allow viewers to make multiple choices in the poll"
|
|
||||||
},
|
|
||||||
"poll-expires-in": {
|
|
||||||
"type": "TimeDurationFlagValue",
|
|
||||||
"description": "The duration in which the poll is open for"
|
|
||||||
},
|
|
||||||
"poll-hides-vote-counts": {
|
|
||||||
"type": "bool",
|
|
||||||
"description": "Set to true to hide the vote count until the poll is closed"
|
|
||||||
},
|
|
||||||
"poll-option": {
|
|
||||||
"type": "MultiStringFlagValue",
|
|
||||||
"description": "A poll option. Use this multiple times to set multiple options"
|
|
||||||
},
|
|
||||||
"sensitive": {
|
|
||||||
"type": "BoolPtrFlagValue",
|
|
||||||
"description": "Set to true if the status should be marked as sensitive"
|
|
||||||
},
|
|
||||||
"show-reposts": {
|
"show-reposts": {
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
"description": "Show reposts from the account you want to follow"
|
"description": "Show reposts from the account you want to follow"
|
||||||
},
|
},
|
||||||
"spoiler-text": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The text to display as the status' warning or subject"
|
|
||||||
},
|
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The type of resource you want to action on (e.g. account, status)"
|
"description": "The type of resource you want to action on (e.g. account, status)"
|
||||||
|
@ -111,10 +39,6 @@
|
||||||
"to": {
|
"to": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "TBC"
|
"description": "TBC"
|
||||||
},
|
|
||||||
"visibility": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The visibility of the posted status"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -139,41 +63,13 @@
|
||||||
"useConfig": true,
|
"useConfig": true,
|
||||||
"usePrinter": true
|
"usePrinter": true
|
||||||
},
|
},
|
||||||
"create": {
|
|
||||||
"additionalFields": [],
|
|
||||||
"flags": [
|
|
||||||
{ "flag": "add-poll", "default": "false" },
|
|
||||||
{ "flag": "content", "default": "" },
|
|
||||||
{ "flag": "content-type", "default": "plain" },
|
|
||||||
{ "flag": "enable-federation", "fieldName": "federated", "default": "true" },
|
|
||||||
{ "flag": "enable-likes", "fieldName": "likeable", "default": "true" },
|
|
||||||
{ "flag": "enable-replies", "fieldName": "replyable", "default": "true" },
|
|
||||||
{ "flag": "enable-reposts", "fieldName": "boostable", "default": "true" },
|
|
||||||
{ "flag": "from-file", "default": "" },
|
|
||||||
{ "flag": "in-reply-to", "default": "" },
|
|
||||||
{ "flag": "language", "default": "" },
|
|
||||||
{ "flag": "list-replies-policy", "default": "list" },
|
|
||||||
{ "flag": "list-title", "default": "" },
|
|
||||||
{ "flag": "poll-allows-multiple-choices", "default": "false" },
|
|
||||||
{ "flag": "poll-expires-in" },
|
|
||||||
{ "flag": "poll-hides-vote-counts", "default": "false" },
|
|
||||||
{ "flag": "poll-option", "fieldName": "pollOptions" },
|
|
||||||
{ "flag": "sensitive" },
|
|
||||||
{ "flag": "spoiler-text", "default": "" },
|
|
||||||
{ "flag": "type", "fieldName": "resourceType", "default": "" },
|
|
||||||
{ "flag": "visibility", "default": "" }
|
|
||||||
],
|
|
||||||
"summary": "Creates a specific resource",
|
|
||||||
"useConfig": true,
|
|
||||||
"usePrinter": true
|
|
||||||
},
|
|
||||||
"delete": {
|
"delete": {
|
||||||
"additionalFields": [],
|
"additionalFields": [],
|
||||||
"flags": [
|
"flags": [
|
||||||
{ "flag": "list-id", "fieldName": "listID", "default": ""},
|
{ "flag": "list-id", "fieldName": "listID", "default": ""},
|
||||||
{ "flag": "type", "fieldName": "resourceType", "default": "" }
|
{ "flag": "type", "fieldName": "resourceType", "default": "" }
|
||||||
],
|
],
|
||||||
"summary": "Deletes a specific resource",
|
"summary": "Delete a specific resource",
|
||||||
"useConfig": true,
|
"useConfig": true,
|
||||||
"usePrinter": true
|
"usePrinter": true
|
||||||
},
|
},
|
||||||
|
@ -219,18 +115,6 @@
|
||||||
"useConfig": true,
|
"useConfig": true,
|
||||||
"usePrinter": true
|
"usePrinter": true
|
||||||
},
|
},
|
||||||
"mute": {
|
|
||||||
"additionalFields": [],
|
|
||||||
"flags": [
|
|
||||||
{ "flag": "account-name", "default": "" },
|
|
||||||
{ "flag": "mute-duration" },
|
|
||||||
{ "flag": "mute-notifications", "default": "false" },
|
|
||||||
{ "flag": "type", "fieldName": "resourceType", "default": "" }
|
|
||||||
],
|
|
||||||
"summary": "Mutes a specific resource (e.g. an account)",
|
|
||||||
"useConfig": true,
|
|
||||||
"usePrinter": true
|
|
||||||
},
|
|
||||||
"reject": {
|
"reject": {
|
||||||
"additionalFields": [],
|
"additionalFields": [],
|
||||||
"flags": [
|
"flags": [
|
||||||
|
@ -271,16 +155,6 @@
|
||||||
"useConfig": true,
|
"useConfig": true,
|
||||||
"usePrinter": true
|
"usePrinter": true
|
||||||
},
|
},
|
||||||
"unmute": {
|
|
||||||
"additionalFields": [],
|
|
||||||
"flags": [
|
|
||||||
{ "flag": "account-name", "default": "" },
|
|
||||||
{ "flag": "type", "fieldName": "resourceType", "default": "" }
|
|
||||||
],
|
|
||||||
"summary": "Umutes a specific resource (e.g. an account)",
|
|
||||||
"useConfig": true,
|
|
||||||
"usePrinter": true
|
|
||||||
},
|
|
||||||
"version": {
|
"version": {
|
||||||
"additionalFields": [
|
"additionalFields": [
|
||||||
{ "name": "binaryVersion", "type": "string"},
|
{ "name": "binaryVersion", "type": "string"},
|
||||||
|
|
Loading…
Reference in a new issue