Commit 8f149d40 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 54d87e6d
......@@ -417,30 +417,34 @@ def xreadlines(r):
@func
def cmd_allstructs(argv):
if len(argv) != 5:
print("Usage: treegen allstructs <maxdepth> <maxsplit> <n>(/<seed>) <kv1> <kv2>", file=sys.stderr)
sys.exit(1)
r = six.StringIO(' '.join(argv))
AllStructsSrv(r)
if argv == ['-h']:
print("Usage: cat requests |treegen allstructs", file=sys.stderr)
print(" treegen allstructs <request>", file=sys.stderr)
sys.exit(0)
@func
def cmd_allstructs_srv(argv):
r = sys.stdin
if len(argv) != 0:
print("Usage: cat requests |treegen allstructs.srv", file=sys.stderr)
sys.exit(1)
AllStructsSrv(sys.stdin)
r = six.StringIO(' '.join(argv))
AllStructsSrv(r)
@func
def cmd_trees(argv):
if len(argv) != 1:
print("Usage: cat trees |treegen trees <zurl>", file=sys.stderr)
sys.exit(1)
if argv in ([], ['-h']):
print("Usage: cat trees |treegen trees <zurl>", file=sys.stderr)
print(" treegen trees <zurl> <tree>+", file=sys.stderr)
sys.exit(1 if argv==[] else 0)
zurl = argv[0]
zstor = storageFromURL(zurl)
defer(zstor.close)
Trees(zstor, sys.stdin)
r = sys.stdin
treev = argv[1:]
if len(treev) != 0:
r = six.StringIO('\n'.join(treev))
Trees(zstor, r)
# xprint prints msg to stdout and flushes it.
......@@ -450,9 +454,8 @@ def xprint(msg):
cmdRegistry = {
'allstructs': cmd_allstructs,
'allstructs.srv': cmd_allstructs_srv,
'trees': cmd_trees,
'allstructs': cmd_allstructs,
'trees': cmd_trees,
}
def main():
......
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