]> arthur.barton.de Git - bup.git/blob - cmd/random-cmd.py
Move cmd-*.py to cmd/*-cmd.py.
[bup.git] / cmd / random-cmd.py
1 #!/usr/bin/env python
2 import sys, mmap
3 from bup import options, _hashsplit
4 from bup.helpers import *
5
6 optspec = """
7 bup random [-S seed] <numbytes>
8 --
9 S,seed=   optional random number seed (default 1)
10 """
11 o = options.Options('bup random', optspec)
12 (opt, flags, extra) = o.parse(sys.argv[1:])
13
14 if len(extra) != 1:
15     o.fatal("exactly one argument expected")
16
17 total = parse_num(extra[0])
18 _hashsplit.write_random(sys.stdout.fileno(), total, opt.seed or 0)