From 39025b9f150e6edd6f2b3aa78ae1b048f4d4fc8b Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 23 Feb 2019 19:00:25 +0100 Subject: [PATCH] jp (blog/edit): changed comments handling: "-C" now allow comment and "--no-comments" explicitly disable it. This way when none of this option is used, the current state of the item is kept without deleting accidentaly the comments node. --- sat_frontends/jp/cmd_blog.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sat_frontends/jp/cmd_blog.py b/sat_frontends/jp/cmd_blog.py index 23e1d988..0adcfd42 100644 --- a/sat_frontends/jp/cmd_blog.py +++ b/sat_frontends/jp/cmd_blog.py @@ -116,9 +116,18 @@ class BlogPublishCommon(object): action="append", help=_(u"tag (category) of your item"), ) - self.parser.add_argument( - "-C", "--comments", action="store_true", help=_(u"enable comments") + + comments_group = self.parser.add_mutually_exclusive_group() + comments_group.add_argument( + "-C", "--comments", action="store_const", const=True, dest="comments", + help=_(u"enable comments (default: comments not enabled except if they " + u"already exist)") ) + comments_group.add_argument( + "--no-comments", action="store_const", const=False, dest="comments", + help=_(u"disable comments (will remove comments node if it exist)") + ) + self.parser.add_argument( "-S", "--syntax",