# HG changeset patch # User Goffi # Date 1657796119 -7200 # Node ID b337d7da72e5192dd507a7a270ecd76edbd7a416 # Parent 5b192a5eb72d892dd4397c13569cbab6267cb36f li (blog): new `repeat` subcommand, to re-publish a blog post: rel 370 diff -r 5b192a5eb72d -r b337d7da72e5 sat_frontends/jp/cmd_blog.py --- a/sat_frontends/jp/cmd_blog.py Wed Jul 13 12:15:04 2022 +0200 +++ b/sat_frontends/jp/cmd_blog.py Thu Jul 14 12:55:19 2022 +0200 @@ -676,6 +676,39 @@ self.host.quit(C.EXIT_OK) +class Repeat(base.CommandBase): + def __init__(self, host): + super().__init__( + host, + "repeat", + use_pubsub=True, + pubsub_flags={C.SINGLE_ITEM}, + help=_("repeat (re-publish) a blog item"), + ) + + def add_parser_options(self): + pass + + async def start(self): + try: + repeat_id = await self.host.bridge.mbRepeat( + self.args.service, + self.args.node, + self.args.item, + "", + self.profile, + ) + except Exception as e: + self.disp(f"can't repeat item: {e}", error=True) + self.host.quit(C.EXIT_BRIDGE_ERRBACK) + else: + if repeat_id: + self.disp(f"Item repeated at ID {str(repeat_id)!r}") + else: + self.disp("Item repeated") + self.host.quit(C.EXIT_OK) + + class Preview(base.CommandBase, common.BaseEdit): # TODO: need to be rewritten with template output @@ -1039,7 +1072,7 @@ class Blog(base.CommandBase): - subcommands = (Set, Get, Edit, Rename, Preview, Import) + subcommands = (Set, Get, Edit, Rename, Repeat, Preview, Import) def __init__(self, host): super(Blog, self).__init__(