add --glob option to pull
This commit is contained in:
parent
5a1e2b19f0
commit
e15232abd0
@ -16,7 +16,9 @@ from etherdump.commands.common import *
|
||||
from time import sleep
|
||||
from etherdump.commands.html5tidy import html5tidy
|
||||
import html5lib
|
||||
from xml.etree import ElementTree as ET
|
||||
from xml.etree import ElementTree as ET
|
||||
from fnmatch import fnmatch
|
||||
|
||||
# debugging
|
||||
# import ElementTree as ET
|
||||
|
||||
@ -41,7 +43,10 @@ def try_deleting (files):
|
||||
|
||||
def main (args):
|
||||
p = ArgumentParser("Check for pads that have changed since last sync (according to .meta.json)")
|
||||
|
||||
p.add_argument("padid", nargs="*", default=[])
|
||||
p.add_argument("--glob", default=False, help="download pads matching a glob pattern")
|
||||
|
||||
p.add_argument("--padinfo", default=".etherdump/settings.json", help="settings, default: .etherdump/settings.json")
|
||||
p.add_argument("--zerorevs", default=False, action="store_true", help="include pads with zero revisions, default: False (i.e. pads with no revisions are skipped)")
|
||||
p.add_argument("--pub", default="p", help="folder to store files for public pads, default: p")
|
||||
@ -76,7 +81,10 @@ def main (args):
|
||||
data['apikey'] = info['apikey']
|
||||
|
||||
if args.padid:
|
||||
padids = args.padid
|
||||
padids = args.padid
|
||||
elif args.glob:
|
||||
padids = getjson(info['apiurl']+'listAllPads?'+urlencode(data))['data']['padIDs']
|
||||
padids = [x for x in padids if fnmatch(x, args.glob)]
|
||||
else:
|
||||
padids = getjson(info['apiurl']+'listAllPads?'+urlencode(data))['data']['padIDs']
|
||||
padids.sort()
|
||||
|
Loading…
Reference in New Issue
Block a user