]> arthur.barton.de Git - bup.git/blob - lib/bup/cmd/rm.py
pylint: enable consider-using-in
[bup.git] / lib / bup / cmd / rm.py
1
2 from __future__ import absolute_import
3
4 from bup.compat import argv_bytes
5 from bup.git import check_repo_or_die
6 from bup.options import Options
7 from bup.helpers import die_if_errors
8 from bup.repo import LocalRepo
9 from bup.rm import bup_rm
10
11 optspec = """
12 bup rm <branch|save...>
13 --
14 #,compress=  set compression level to # (0-9, 9 is highest) [6]
15 v,verbose    increase verbosity (can be specified multiple times)
16 unsafe       use the command even though it may be DANGEROUS
17 """
18
19 def main(argv):
20     o = Options(optspec)
21     opt, flags, extra = o.parse_bytes(argv[1:])
22
23     if not opt.unsafe:
24         o.fatal('refusing to run dangerous, experimental command without --unsafe')
25
26     if len(extra) < 1:
27         o.fatal('no paths specified')
28
29     check_repo_or_die()
30     repo = LocalRepo()
31     bup_rm(repo, [argv_bytes(x) for x in extra],
32            compression=opt.compress, verbosity=opt.verbose)
33     die_if_errors()