diff --git a/sat_frontends/jp/cmd_pubsub.py b/sat_frontends/jp/cmd_pubsub.py index 4aff6feb..217401a7 100644 --- a/sat_frontends/jp/cmd_pubsub.py +++ b/sat_frontends/jp/cmd_pubsub.py @@ -2473,7 +2473,6 @@ class AttachmentSet(base.CommandBase): def add_parser_options(self): self.parser.add_argument( - "-R", "--replace", action="store_true", help=_( @@ -2492,9 +2491,16 @@ class AttachmentSet(base.CommandBase): self.parser.add_argument( "-r", "--reactions", - # FIXME: to be replace by "extend" when we stop supporting python 3.7 + # FIXME: to be replaced by "extend" when we stop supporting python 3.7 action="append", - help=_("add emojis to react to an item") + help=_("emojis to add to react to an item") + ) + self.parser.add_argument( + "-R", + "--reactions-remove", + # FIXME: to be replaced by "extend" when we stop supporting python 3.7 + action="append", + help=_("emojis to remove from reactions to an item") ) async def start(self): @@ -2510,11 +2516,16 @@ class AttachmentSet(base.CommandBase): self.args.noticed = C.BOOL_TRUE mb_data["extra"]["noticed"] = C.bool(self.args.noticed) - if self.args.reactions is not None: - mb_data["extra"]["reaction"] = { - "operation": operation, - "reactions": [r for emojis in self.args.reactions for r in emojis] + if self.args.reactions or self.args.reactions_remove: + reactions = mb_data["extra"]["reactions"] = { + "operation": operation } + if self.args.replace: + reactions["reactions"] = self.args.reactions + else: + reactions["add"] = self.args.reactions + reactions["remove"] = self.args.reactions_remove + if not mb_data["extra"]: self.parser.error(_("At leat one attachment must be specified."))