Unverified Commit f9bb4444 authored by decentral1se's avatar decentral1se
Browse files

Add `__PUBLISH__` logic

Closes aa/etherdump#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.
parent 4a8219b4
Pipeline #249 failed with stages
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment