Remove deprecated flag (`--unset`) default tip master
authorMikael Berthe <mikael@lilotux.net>
Sat, 04 Feb 2023 13:35:58 +0100
changeset 271 c8b8b7cc8896
parent 270 df7e9dff1b66
Remove deprecated flag (`--unset`)
README.md
cmd/accounts.go
cmd/status.go
--- a/README.md	Sat Feb 04 13:26:06 2023 +0100
+++ b/README.md	Sat Feb 04 13:35:58 2023 +0100
@@ -150,14 +150,12 @@
 % madonctl status --status-id 416671 boost        # Boost (reblog) a status
 
 % madonctl status --status-id 416671 unboost       # Cancel a boost
-% madonctl status --status-id 416671 boost --unset # Cancel a boost (deprecated)
 ```
 
 **Pin/unpin** a status...
 ``` sh
 % madonctl status --status-id 533769 pin          # Pin a status
 % madonctl status --status-id 533769 unpin        # Unpin a status
-% madonctl status --status-id 533769 pin --unset  # Unpin a status (deprecated)
 ```
 
 **Pin/unpin** an account (i.e., account endorsement)...
--- a/cmd/accounts.go	Sat Feb 04 13:26:06 2023 +0100
+++ b/cmd/accounts.go	Sat Feb 04 13:35:58 2023 +0100
@@ -22,7 +22,6 @@
 var accountsOpts struct {
 	accountID             madon.ActivityID
 	accountUID            string
-	unset                 bool             // TODO remove eventually?
 	limit, keep           uint             // Limit the results
 	sinceID, maxID        madon.ActivityID // Query boundaries
 	all                   bool             // Try to fetch all results
@@ -70,11 +69,7 @@
 	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 (deprecated)")
-
-	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 (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,11 +92,6 @@
 	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()
@@ -452,7 +442,7 @@
 		if opt.accountID != "" && opt.remoteUID != "" {
 			return errors.New("cannot use both account ID and URI")
 		}
-		if (opt.unset || subcmd == "unfollow") && opt.accountID == "" {
+		if subcmd == "unfollow" && opt.accountID == "" {
 			return errors.New("unfollowing requires an account ID")
 		}
 	case "follow-requests":
@@ -569,7 +559,7 @@
 		obj = statusList
 	case "follow", "unfollow":
 		var relationship *madon.Relationship
-		if opt.unset || subcmd == "unfollow" {
+		if subcmd == "unfollow" {
 			relationship, err = gClient.UnfollowAccount(opt.accountID)
 			obj = relationship
 			break
@@ -621,7 +611,7 @@
 		}
 	case "block", "unblock":
 		var relationship *madon.Relationship
-		if opt.unset || subcmd == "unblock" {
+		if subcmd == "unblock" {
 			relationship, err = gClient.UnblockAccount(opt.accountID)
 		} else {
 			relationship, err = gClient.BlockAccount(opt.accountID)
@@ -629,7 +619,7 @@
 		obj = relationship
 	case "mute", "unmute":
 		var relationship *madon.Relationship
-		if opt.unset || subcmd == "unmute" {
+		if subcmd == "unmute" {
 			relationship, err = gClient.UnmuteAccount(opt.accountID)
 		} else {
 			var muteNotif *bool
--- a/cmd/status.go	Sat Feb 04 13:26:06 2023 +0100
+++ b/cmd/status.go	Sat Feb 04 13:35:58 2023 +0100
@@ -21,7 +21,6 @@
 
 var statusOpts struct {
 	statusID madon.ActivityID
-	unset    bool // TODO remove eventually?
 
 	// The following fields are used for the post/toot command
 	visibility     string
@@ -59,9 +58,6 @@
 	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 (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)")
@@ -73,11 +69,6 @@
 	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"}
@@ -304,19 +295,19 @@
 	case "delete":
 		err = gClient.DeleteStatus(opt.statusID)
 	case "boost", "unboost":
-		if opt.unset || subcmd == "unboost" {
+		if subcmd == "unboost" {
 			err = gClient.UnreblogStatus(opt.statusID)
 		} else {
 			err = gClient.ReblogStatus(opt.statusID)
 		}
 	case "favourite", "unfavourite":
-		if opt.unset || subcmd == "unfavourite" {
+		if subcmd == "unfavourite" {
 			err = gClient.UnfavouriteStatus(opt.statusID)
 		} else {
 			err = gClient.FavouriteStatus(opt.statusID)
 		}
 	case "pin", "unpin":
-		if opt.unset || subcmd == "unpin" {
+		if subcmd == "unpin" {
 			err = gClient.UnpinStatus(opt.statusID)
 		} else {
 			err = gClient.PinStatus(opt.statusID)