]> arthur.barton.de Git - bup.git/blob - cmd/rm-cmd.py
3464e3c3078ca874494153a72effc553b1b15572
[bup.git] / cmd / rm-cmd.py
1 #!/bin/sh
2 """": # -*-python-*-
3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
5 """
6 # end of bup preamble
7
8 from __future__ import absolute_import
9 import sys
10
11 from bup.git import check_repo_or_die
12 from bup.options import Options
13 from bup.helpers import die_if_errors, handle_ctrl_c, log
14 from bup.repo import LocalRepo
15 from bup.rm import bup_rm
16
17 optspec = """
18 bup rm <branch|save...>
19 --
20 #,compress=  set compression level to # (0-9, 9 is highest) [6]
21 v,verbose    increase verbosity (can be specified multiple times)
22 unsafe       use the command even though it may be DANGEROUS
23 """
24
25 handle_ctrl_c()
26
27 o = Options(optspec)
28 opt, flags, extra = o.parse(sys.argv[1:])
29
30 if not opt.unsafe:
31     o.fatal('refusing to run dangerous, experimental command without --unsafe')
32
33 if len(extra) < 1:
34     o.fatal('no paths specified')
35
36 check_repo_or_die()
37 repo = LocalRepo()
38 bup_rm(repo, extra, compression=opt.compress, verbosity=opt.verbose)
39 die_if_errors()