# HG changeset patch # User Mikael Berthe # Date 1521461976 -3600 # Node ID 842f6cea448fc525e14e522519d55eceaf63ef96 # Parent 0f3fb2d27ddb497daee02ac46d71b94cc5349a38 madonctl accounts mute: Add '--notifications' flag diff -r 0f3fb2d27ddb -r 842f6cea448f cmd/accounts.go --- a/cmd/accounts.go Mon Mar 19 11:47:29 2018 +0100 +++ b/cmd/accounts.go Mon Mar 19 13:19:36 2018 +0100 @@ -34,9 +34,10 @@ displayName, note string // For account update avatar, header string // For account update locked bool // For account update + muteNotifications bool // For account mute } -var accountUpdateFlags *flag.FlagSet +var accountUpdateFlags, accountMuteFlags *flag.FlagSet func init() { RootCmd.AddCommand(accountsCmd) @@ -64,6 +65,7 @@ accountBlockSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unblock the account") accountMuteSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unmute the account") + accountMuteSubcommand.Flags().BoolVarP(&accountsOpts.muteNotifications, "notifications", "", true, "Mute the notifications") accountFollowSubcommand.Flags().BoolVarP(&accountsOpts.unset, "unset", "", false, "Unfollow the account") accountFollowSubcommand.Flags().StringVarP(&accountsOpts.remoteUID, "remote", "r", "", "Follow remote account (user@domain)") @@ -81,6 +83,7 @@ // This one will be used to check if the options were explicitly set or not accountUpdateFlags = accountUpdateSubcommand.Flags() + accountMuteFlags = accountMuteSubcommand.Flags() } // accountsCmd represents the accounts command @@ -451,7 +454,11 @@ if opt.unset { relationship, err = gClient.UnmuteAccount(opt.accountID) } else { - relationship, err = gClient.MuteAccount(opt.accountID) + var muteNotif *bool + if accountMuteFlags.Lookup("notifications").Changed { + muteNotif = &opt.muteNotifications + } + relationship, err = gClient.MuteAccount(opt.accountID, muteNotif) } obj = relationship case "favourites":