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

.

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