2 from __future__ import absolute_import, print_function
5 from bup import options, version
6 from bup.io import byte_stream
8 version_rx = re.compile(r'^[0-9]+\.[0-9]+(\.[0-9]+)?(-[0-9]+-g[0-9abcdef]+)?$')
11 bup version [--date|--commit]
13 date display the date this version of bup was created
14 commit display the git commit id of this version of bup
18 o = options.Options(optspec)
19 opt, flags, extra = o.parse_bytes(argv[1:])
22 total = (opt.date or 0) + (opt.commit or 0)
24 o.fatal('at most one option expected')
27 out = byte_stream(sys.stdout)
30 out.write(version.date.split(b' ')[0] + b'\n')
32 out.write(version.commit + b'\n')
34 out.write(version.version + b'\n')