li (blog): new repeat subcommand, to re-publish a blog post:
rel 370
This commit is contained in:
parent
2550264eda
commit
b533b3e56c
1 changed files with 34 additions and 1 deletions
|
|
@ -676,6 +676,39 @@ class Rename(base.CommandBase):
|
|||
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 Import(base.CommandBase):
|
|||
|
||||
|
||||
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__(
|
||||
|
|
|
|||
Loading…
Reference in a new issue