From f9bb4444e239c78977643c0548b0300cfb8911b2 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Wed, 6 Mar 2019 10:17:18 +0100 Subject: [PATCH] Add `__PUBLISH__` logic Closes https://gitlab.constantvzw.org/aa/etherdump/issues/3. This allows for the following to be run: etherdump pull --publish-opt-in --all --pub mydump And if `__PUBLISH__` is not present on the pads, then the pad will not be archived. It is also possible to configure this magic word by specifying the `--publish ...` option. --- etherdump/commands/pull.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etherdump/commands/pull.py b/etherdump/commands/pull.py index 220c193..8b54460 100644 --- a/etherdump/commands/pull.py +++ b/etherdump/commands/pull.py @@ -69,6 +69,8 @@ def main (args): p.add_argument("--script", default="/versions.js", help="add script url to output pages, default: /versions.js") p.add_argument("--nopublish", default="__NOPUBLISH__", help="no publish magic word, default: __NOPUBLISH__") + p.add_argument("--publish", default="__PUBLISH__", help="the publish magic word, default: __PUBLISH__") + p.add_argument("--publish-opt-in", default=False, action="store_true", help="ensure `--publish` is honoured instead of `--nopublish`") args = p.parse_args(args) @@ -187,6 +189,13 @@ def main (args): try_deleting((p+raw_ext,p+".raw.html",p+".diff.html",p+".meta.json")) continue + ########################################## + ## ENFORCE __PUBLISH__ MAGIC WORD + ########################################## + if args.publish_opt_in and args.publish not in text: + try_deleting((p+raw_ext,p+".raw.html",p+".diff.html",p+".meta.json")) + continue + ver["path"] = p+raw_ext ver["url"] = quote(ver["path"]) with open(ver["path"], "w") as f: