]> arthur.barton.de Git - bup.git/blob - cmd/rm-cmd.py
rm: move core code to bup.rm module
[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 import sys
9
10 from bup.git import check_repo_or_die
11 from bup.options import Options
12 from bup.helpers import die_if_errors, handle_ctrl_c, log
13 from bup.rm import bup_rm
14
15 optspec = """
16 bup rm <branch|save...>
17 --
18 #,compress=  set compression level to # (0-9, 9 is highest) [6]
19 v,verbose    increase verbosity (can be specified multiple times)
20 unsafe       use the command even though it may be DANGEROUS
21 """
22
23 handle_ctrl_c()
24
25 o = Options(optspec)
26 opt, flags, extra = o.parse(sys.argv[1:])
27
28 if not opt.unsafe:
29     o.fatal('refusing to run dangerous, experimental command without --unsafe')
30
31 if len(extra) < 1:
32     o.fatal('no paths specified')
33
34 check_repo_or_die()
35 bup_rm(extra, opt)
36 die_if_errors()