cmd/accounts.go
changeset 209 3772cc6b3d0a
parent 208 7a830fed2ba3
child 218 49d626ce0b01
equal deleted inserted replaced
208:7a830fed2ba3 209:3772cc6b3d0a
    96 }
    96 }
    97 
    97 
    98 // accountsCmd represents the accounts command
    98 // accountsCmd represents the accounts command
    99 // This command does nothing without a subcommand
    99 // This command does nothing without a subcommand
   100 var accountsCmd = &cobra.Command{
   100 var accountsCmd = &cobra.Command{
   101 	Use:     "accounts [--account-id ID] subcommand",
   101 	Use:     "account [--account-id ID] subcommand",
   102 	Aliases: []string{"account"},
   102 	Aliases: []string{"accounts"},
   103 	Short:   "Account-related functions",
   103 	Short:   "Account-related functions",
   104 	//Long:    `TBW...`, // TODO
   104 	//Long:    `TBW...`, // TODO
   105 }
   105 }
   106 
   106 
   107 // Note: Some account subcommands are not defined in this file.
   107 // Note: Some account subcommands are not defined in this file.
   112 If no account ID is specified, the current user account is used.`,
   112 If no account ID is specified, the current user account is used.`,
   113 		Aliases: []string{"display"},
   113 		Aliases: []string{"display"},
   114 		Short:   "Display the account",
   114 		Short:   "Display the account",
   115 		Example: `  madonctl account show   # Display your own account
   115 		Example: `  madonctl account show   # Display your own account
   116 
   116 
   117   madonctl accounts show --account-id 1234
   117   madonctl account show --account-id 1234
   118   madonctl accounts show --user-id Gargron@mastodon.social
   118   madonctl account show --user-id Gargron@mastodon.social
   119   madonctl accounts show --user-id https://mastodon.social/@Gargron
   119   madonctl account show --user-id https://mastodon.social/@Gargron
   120 
   120 
   121   madonctl accounts show 1234
   121   madonctl account show 1234
   122   madonctl accounts show Gargron@mastodon.social
   122   madonctl account show Gargron@mastodon.social
   123   madonctl accounts show https://mastodon.social/@Gargron
   123   madonctl account show https://mastodon.social/@Gargron
   124 `,
   124 `,
   125 		RunE: func(cmd *cobra.Command, args []string) error {
   125 		RunE: func(cmd *cobra.Command, args []string) error {
   126 			return accountSubcommandsRunE(cmd.Name(), args)
   126 			return accountSubcommandsRunE(cmd.Name(), args)
   127 		},
   127 		},
   128 	},
   128 	},
   189 
   189 
   190 var accountStatusesSubcommand = &cobra.Command{
   190 var accountStatusesSubcommand = &cobra.Command{
   191 	Use:     "statuses",
   191 	Use:     "statuses",
   192 	Aliases: []string{"st"},
   192 	Aliases: []string{"st"},
   193 	Short:   "Display the account statuses",
   193 	Short:   "Display the account statuses",
   194 	Example: `  madonctl accounts statuses
   194 	Example: `  madonctl account statuses
   195   madonctl accounts statuses 404                         # local account numeric ID
   195   madonctl account statuses 404                         # local account numeric ID
   196   madonctl accounts statuses @McKael                     # local account
   196   madonctl account statuses @McKael                     # local account
   197   madonctl accounts statuses Gargron@mastodon.social     # remote (known account)
   197   madonctl account statuses Gargron@mastodon.social     # remote (known account)
   198   madonctl accounts statuses https://mastodon.social/@Gargron  # any account URL
   198   madonctl account statuses https://mastodon.social/@Gargron  # any account URL
   199 `,
   199 `,
   200 	RunE: func(cmd *cobra.Command, args []string) error {
   200 	RunE: func(cmd *cobra.Command, args []string) error {
   201 		return accountSubcommandsRunE(cmd.Name(), args)
   201 		return accountSubcommandsRunE(cmd.Name(), args)
   202 	},
   202 	},
   203 }
   203 }
   204 
   204 
   205 var accountFollowRequestsSubcommand = &cobra.Command{
   205 var accountFollowRequestsSubcommand = &cobra.Command{
   206 	Use:     "follow-requests",
   206 	Use:     "follow-requests",
   207 	Aliases: []string{"follow-request", "fr"},
   207 	Aliases: []string{"follow-request", "fr"},
   208 	Example: `  madonctl accounts follow-requests --list
   208 	Short:   "List, accept or deny a follow request",
   209   madonctl accounts follow-requests --account-id X --accept
   209 	Example: `  madonctl account follow-requests --list
   210   madonctl accounts follow-requests --account-id Y --reject`,
   210   madonctl account follow-requests --account-id X --accept
   211 	Short: "List, accept or deny a follow request",
   211   madonctl account follow-requests --account-id Y --reject`,
   212 	RunE: func(cmd *cobra.Command, args []string) error {
   212 	RunE: func(cmd *cobra.Command, args []string) error {
   213 		return accountSubcommandsRunE(cmd.Name(), args)
   213 		return accountSubcommandsRunE(cmd.Name(), args)
   214 	},
   214 	},
   215 }
   215 }
   216 var accountFollowSubcommand = &cobra.Command{
   216 var accountFollowSubcommand = &cobra.Command{
   217 	Use:   "follow",
   217 	Use:   "follow",
   218 	Short: "Follow or unfollow the account",
   218 	Short: "Follow or unfollow the account",
   219 	Example: `# Argument type can be set explicitly:
   219 	Example: `# Argument type can be set explicitly:
   220   madonctl accounts follow --account-id 1234
   220   madonctl account follow --account-id 1234
   221   madonctl accounts follow --remote Gargron@mastodon.social
   221   madonctl account follow --remote Gargron@mastodon.social
   222 
   222 
   223 # Or argument type can be guessed:
   223 # Or argument type can be guessed:
   224   madonctl accounts follow 4800
   224   madonctl account follow 4800
   225   madonctl accounts follow Gargron@mastodon.social --show-reblogs=false
   225   madonctl account follow Gargron@mastodon.social --show-reblogs=false
   226   madonctl accounts follow https://mastodon.social/@Gargron
   226   madonctl account follow https://mastodon.social/@Gargron
   227 `,
   227 `,
   228 	RunE: func(cmd *cobra.Command, args []string) error {
   228 	RunE: func(cmd *cobra.Command, args []string) error {
   229 		return accountSubcommandsRunE(cmd.Name(), args)
   229 		return accountSubcommandsRunE(cmd.Name(), args)
   230 	},
   230 	},
   231 }
   231 }
   255 }
   255 }
   256 
   256 
   257 var accountReportsSubcommand = &cobra.Command{
   257 var accountReportsSubcommand = &cobra.Command{
   258 	Use:   "reports",
   258 	Use:   "reports",
   259 	Short: "List reports or report a user account",
   259 	Short: "List reports or report a user account",
   260 	Example: `  madonctl accounts reports --list
   260 	Example: `  madonctl account reports --list
   261   madonctl accounts reports --account-id ACCOUNT --status-ids ID... --comment TEXT`,
   261   madonctl account reports --account-id ACCOUNT --status-ids ID... --comment TEXT`,
   262 	RunE: func(cmd *cobra.Command, args []string) error {
   262 	RunE: func(cmd *cobra.Command, args []string) error {
   263 		return accountSubcommandsRunE(cmd.Name(), args)
   263 		return accountSubcommandsRunE(cmd.Name(), args)
   264 	},
   264 	},
   265 }
   265 }
   266 
   266 
   273 The flags --avatar and --header can be paths to image files or base64-encoded
   273 The flags --avatar and --header can be paths to image files or base64-encoded
   274 images (see Mastodon API specifications for the details).
   274 images (see Mastodon API specifications for the details).
   275 
   275 
   276 Please note the avatar and header images cannot be removed, they can only be
   276 Please note the avatar and header images cannot be removed, they can only be
   277 replaced.`,
   277 replaced.`,
   278 	Example: `  madonctl accounts update --display-name "Mr President"
   278 	Example: `  madonctl account update --display-name "Mr President"
   279   madonctl accounts update --note "I like madonctl"
   279   madonctl account update --note "I like madonctl"
   280   madonctl accounts update --avatar happyface.png`,
   280   madonctl account update --avatar happyface.png`,
   281 	RunE: func(cmd *cobra.Command, args []string) error {
   281 	RunE: func(cmd *cobra.Command, args []string) error {
   282 		return accountSubcommandsRunE(cmd.Name(), args)
   282 		return accountSubcommandsRunE(cmd.Name(), args)
   283 	},
   283 	},
   284 }
   284 }
   285 
   285