# HG changeset patch # User Goffi # Date 1582046238 -3600 # Node ID f4914ce9d47d9ee9195ce6866a7dbf06cd02f4ee # Parent 4b5c7767301516e7cddaba4c0f44499f7010d0a0 jp (blog/edit): added `--no-publish` argument. diff -r 4b5c77673015 -r f4914ce9d47d doc/jp/blog.rst --- a/doc/jp/blog.rst Tue Feb 18 18:17:18 2020 +0100 +++ b/doc/jp/blog.rst Tue Feb 18 18:17:18 2020 +0100 @@ -76,11 +76,11 @@ If you don't change anything or publish an empty blog post, the edition will be cancelled. -In the metadata (see `below `_ for details), you can use -``"publish": false`` to forbid the publication. In this case, when you'll save -your modification and quit your editor, the blog post will not be published but -saved locally in a draft. To continue your work later, just start your edition with the -``-D, --current`` option like this:: +In the metadata (see `below `_ for details), you can use ``"publish": +false`` to forbid the publication (or set it with ``--no-publish argument``). In this +case, when you'll save your modification and quit your editor, the blog post will not be +published but saved locally in a draft. To continue your work later, just start your +edition with the ``-D, --current`` option like this:: $ jp blog edit -D diff -r 4b5c77673015 -r f4914ce9d47d sat_frontends/jp/cmd_blog.py --- a/sat_frontends/jp/cmd_blog.py Tue Feb 18 18:17:18 2020 +0100 +++ b/sat_frontends/jp/cmd_blog.py Tue Feb 18 18:17:18 2020 +0100 @@ -466,6 +466,10 @@ action="store_true", help=_("launch a blog preview in parallel"), ) + self.parser.add_argument( + "--no-publish", + help=_('add "publish: False" to metadata'), + ) def buildMetadataFile(self, content_file_path, mb_data=None): """Build a metadata file using json @@ -506,6 +510,9 @@ # and override metadata with command-line arguments self.setMbDataFromArgs(mb_data) + if self.args.no_publish is not None: + mb_data["publish"] = False + # then we create the file and write metadata there, as JSON dict # XXX: if we port jp one day on Windows, O_BINARY may need to be added here with os.fdopen(