--- a/cmd/accounts.go Fri Sep 07 21:57:10 2018 +0200
+++ b/cmd/accounts.go Fri Sep 07 22:53:59 2018 +0200
@@ -70,11 +70,11 @@
accountFollowRequestsSubcommand.Flags().BoolVar(&accountsOpts.acceptFR, "accept", false, "Accept the follow request from the account ID")
accountFollowRequestsSubcommand.Flags().BoolVar(&accountsOpts.rejectFR, "reject", false, "Reject the follow request from the account ID")
- accountBlockSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unblock the account")
+ accountBlockSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unblock the account (deprecated)")
- accountMuteSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unmute the account")
+ accountMuteSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unmute the account (deprecated)")
accountMuteSubcommand.Flags().BoolVarP(&accountsOpts.muteNotifications, "notifications", "", true, "Mute the notifications")
- accountFollowSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unfollow the account")
+ accountFollowSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unfollow the account (deprecated)")
accountFollowSubcommand.Flags().BoolVarP(&accountsOpts.reblogs, "show-reblogs", "", true, "Follow account's boosts")
accountFollowSubcommand.Flags().StringVarP(&accountsOpts.remoteUID, "remote", "r", "", "Follow remote account (user@domain)")
@@ -97,6 +97,11 @@
accountUpdateSubcommand.Flags().BoolVar(&accountsOpts.locked, "locked", false, "Following account requires approval")
accountUpdateSubcommand.Flags().BoolVar(&accountsOpts.bot, "bot", false, "Set as service (automated) account")
+ // Deprecated flags
+ accountBlockSubcommand.Flags().MarkDeprecated("unset", "please use unblock instead")
+ accountMuteSubcommand.Flags().MarkDeprecated("unset", "please use unmute instead")
+ accountFollowSubcommand.Flags().MarkDeprecated("unset", "please use unfollow instead")
+
// Those variables will be used to check if the options were
// explicitly set or not
accountUpdateFlags = accountUpdateSubcommand.Flags()
@@ -177,8 +182,11 @@
accountStatusesSubcommand,
accountFollowRequestsSubcommand,
accountFollowSubcommand,
+ accountUnfollowSubcommand,
accountBlockSubcommand,
+ accountUnblockSubcommand,
accountMuteSubcommand,
+ accountUnmuteSubcommand,
accountPinSubcommand,
accountUnpinSubcommand,
accountRelationshipsSubcommand,
@@ -227,7 +235,7 @@
}
var accountFollowSubcommand = &cobra.Command{
Use: "follow",
- Short: "Follow or unfollow the account",
+ Short: "Follow an account",
Example: `# Argument type can be set explicitly:
madonctl account follow --account-id 1234
madonctl account follow --remote Gargron@mastodon.social
@@ -242,9 +250,29 @@
},
}
+var accountUnfollowSubcommand = &cobra.Command{
+ Use: "unfollow",
+ Short: "Stop following an account",
+ Example: ` madonctl account unfollow --account-id 1234
+
+Same usage as madonctl follow.
+`,
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return accountSubcommandsRunE(cmd.Name(), args)
+ },
+}
+
var accountBlockSubcommand = &cobra.Command{
Use: "block",
- Short: "Block or unblock the account",
+ Short: "Block the account",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return accountSubcommandsRunE(cmd.Name(), args)
+ },
+}
+
+var accountUnblockSubcommand = &cobra.Command{
+ Use: "unblock",
+ Short: "Unblock the account",
RunE: func(cmd *cobra.Command, args []string) error {
return accountSubcommandsRunE(cmd.Name(), args)
},
@@ -252,7 +280,15 @@
var accountMuteSubcommand = &cobra.Command{
Use: "mute",
- Short: "Mute or unmute the account",
+ Short: "Mute the account",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return accountSubcommandsRunE(cmd.Name(), args)
+ },
+}
+
+var accountUnmuteSubcommand = &cobra.Command{
+ Use: "unmute",
+ Short: "Unmute the account",
RunE: func(cmd *cobra.Command, args []string) error {
return accountSubcommandsRunE(cmd.Name(), args)
},
@@ -408,7 +444,7 @@
if opt.accountID > 0 {
return errors.New("useless account ID")
}
- case "follow":
+ case "follow", "unfollow":
// We need an account ID or a remote UID
if opt.accountID < 1 && opt.remoteUID == "" {
return errors.New("missing account ID or URI")
@@ -416,7 +452,7 @@
if opt.accountID > 0 && opt.remoteUID != "" {
return errors.New("cannot use both account ID and URI")
}
- if opt.unset && opt.accountID < 1 {
+ if (opt.unset || subcmd == "unfollow") && opt.accountID < 1 {
return errors.New("unfollowing requires an account ID")
}
case "follow-requests":
@@ -531,9 +567,9 @@
statusList = statusList[:opt.keep]
}
obj = statusList
- case "follow":
+ case "follow", "unfollow":
var relationship *madon.Relationship
- if opt.unset {
+ if opt.unset || subcmd == "unfollow" {
relationship, err = gClient.UnfollowAccount(opt.accountID)
obj = relationship
break
@@ -583,17 +619,17 @@
} else {
err = gClient.FollowRequestAuthorize(opt.accountID, !opt.rejectFR)
}
- case "block":
+ case "block", "unblock":
var relationship *madon.Relationship
- if opt.unset {
+ if opt.unset || subcmd == "unblock" {
relationship, err = gClient.UnblockAccount(opt.accountID)
} else {
relationship, err = gClient.BlockAccount(opt.accountID)
}
obj = relationship
- case "mute":
+ case "mute", "unmute":
var relationship *madon.Relationship
- if opt.unset {
+ if opt.unset || subcmd == "unmute" {
relationship, err = gClient.UnmuteAccount(opt.accountID)
} else {
var muteNotif *bool
--- a/cmd/status.go Fri Sep 07 21:57:10 2018 +0200
+++ b/cmd/status.go Fri Sep 07 22:53:59 2018 +0200
@@ -21,7 +21,7 @@
var statusOpts struct {
statusID int64
- unset bool
+ unset bool // TODO remove eventually?
// The following fields are used for the post/toot command
visibility string
@@ -56,9 +56,9 @@
statusCmd.PersistentFlags().BoolVar(&statusOpts.all, "all", false, "Fetch all results (for reblogged-by/favourited-by)")
// Subcommand flags
- statusReblogSubcommand.Flags().BoolVar(&statusOpts.unset, "unset", false, "Unreblog the status")
- statusFavouriteSubcommand.Flags().BoolVar(&statusOpts.unset, "unset", false, "Remove the status from the favourites")
- statusPinSubcommand.Flags().BoolVar(&statusOpts.unset, "unset", false, "Unpin the status")
+ statusReblogSubcommand.Flags().BoolVar(&statusOpts.unset, "unset", false, "Unreblog the status (deprecated)")
+ statusFavouriteSubcommand.Flags().BoolVar(&statusOpts.unset, "unset", false, "Remove the status from the favourites (deprecated)")
+ statusPinSubcommand.Flags().BoolVar(&statusOpts.unset, "unset", false, "Unpin the status (deprecated)")
statusPostSubcommand.Flags().BoolVar(&statusOpts.sensitive, "sensitive", false, "Mark post as sensitive (NSFW)")
statusPostSubcommand.Flags().StringVar(&statusOpts.visibility, "visibility", "", "Visibility (direct|private|unlisted|public)")
statusPostSubcommand.Flags().StringVar(&statusOpts.spoiler, "spoiler", "", "Spoiler warning (CW)")
@@ -70,6 +70,11 @@
statusPostSubcommand.Flags().BoolVar(&statusOpts.addMentions, "add-mentions", false, "Add mentions when replying")
statusPostSubcommand.Flags().BoolVar(&statusOpts.sameVisibility, "same-visibility", false, "Use same visibility as original message (for replies)")
+ // Deprecated flags
+ statusReblogSubcommand.Flags().MarkDeprecated("unset", "please use unboost instead")
+ statusFavouriteSubcommand.Flags().MarkDeprecated("unset", "please use unfavourite instead")
+ statusPinSubcommand.Flags().MarkDeprecated("unset", "please use unpin instead")
+
// Flag completion
annotation := make(map[string][]string)
annotation[cobra.BashCompCustom] = []string{"__madonctl_visibility"}
@@ -159,15 +164,27 @@
},
},
statusReblogSubcommand,
+ statusUnreblogSubcommand,
statusFavouriteSubcommand,
+ statusUnfavouriteSubcommand,
statusPinSubcommand,
+ statusUnpinSubcommand,
statusPostSubcommand,
}
var statusReblogSubcommand = &cobra.Command{
Use: "boost",
Aliases: []string{"reblog"},
- Short: "Boost (reblog) or unreblog the status",
+ Short: "Boost (reblog) a status message",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return statusSubcommandRunE(cmd.Name(), args)
+ },
+}
+
+var statusUnreblogSubcommand = &cobra.Command{
+ Use: "unboost",
+ Aliases: []string{"unreblog"},
+ Short: "Cancel boost (reblog) of a status message",
RunE: func(cmd *cobra.Command, args []string) error {
return statusSubcommandRunE(cmd.Name(), args)
},
@@ -176,7 +193,16 @@
var statusFavouriteSubcommand = &cobra.Command{
Use: "favourite",
Aliases: []string{"favorite", "fave"},
- Short: "Mark/unmark the status as favourite",
+ Short: "Mark the status as favourite",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return statusSubcommandRunE(cmd.Name(), args)
+ },
+}
+
+var statusUnfavouriteSubcommand = &cobra.Command{
+ Use: "unfavourite",
+ Aliases: []string{"unfavorite", "unfave"},
+ Short: "Unmark the status as favourite",
RunE: func(cmd *cobra.Command, args []string) error {
return statusSubcommandRunE(cmd.Name(), args)
},
@@ -184,7 +210,15 @@
var statusPinSubcommand = &cobra.Command{
Use: "pin",
- Short: "Pin/unpin the status",
+ Short: "Pin a status",
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return statusSubcommandRunE(cmd.Name(), args)
+ },
+}
+
+var statusUnpinSubcommand = &cobra.Command{
+ Use: "unpin",
+ Short: "Unpin a status",
RunE: func(cmd *cobra.Command, args []string) error {
return statusSubcommandRunE(cmd.Name(), args)
},
@@ -264,20 +298,20 @@
obj = accountList
case "delete":
err = gClient.DeleteStatus(opt.statusID)
- case "boost":
- if opt.unset {
+ case "boost", "unboost":
+ if opt.unset || subcmd == "unboost" {
err = gClient.UnreblogStatus(opt.statusID)
} else {
err = gClient.ReblogStatus(opt.statusID)
}
- case "favourite":
- if opt.unset {
+ case "favourite", "unfavourite":
+ if opt.unset || subcmd == "unfavourite" {
err = gClient.UnfavouriteStatus(opt.statusID)
} else {
err = gClient.FavouriteStatus(opt.statusID)
}
- case "pin":
- if opt.unset {
+ case "pin", "unpin":
+ if opt.unset || subcmd == "unpin" {
err = gClient.UnpinStatus(opt.statusID)
} else {
err = gClient.PinStatus(opt.statusID)