forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrootrm.py
More file actions
executable file
·48 lines (36 loc) · 1.35 KB
/
rootrm.py
File metadata and controls
executable file
·48 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env @python@
# ROOT command line tools: rootrm
# Author: Julien Ripoche
# Mail: julien.ripoche@u-psud.fr
# Date: 20/08/15
"""Command line to remove objects from ROOT files"""
import cmdLineUtils
import sys
# Help strings
description = "Remove objects from ROOT files"
EPILOG = """Examples:
- rootrm example.root:hist
Remove the object 'hist' from the ROOT file 'example.root'
- rootrm example.root:dir/hist
Remove the object 'hist' from the directory 'dir' inside the ROOT file 'example.root'
- rootrm example.root
Remove the ROOT file 'example.root'
- rootrm -i example.root:hist
Display a confirmation request before deleting: 'remove 'hist' from 'example.root' ? (y/n) :'
"""
def get_argparse():
# Collect arguments with the module argparse
parser = cmdLineUtils.getParserFile(description, EPILOG)
parser.prog = 'rootrm'
parser.add_argument("-i","--interactive", help=cmdLineUtils.INTERACTIVE_HELP, action="store_true")
parser.add_argument("-r","--recursive", help=cmdLineUtils.RECURSIVE_HELP, action="store_true")
return parser
def execute():
parser = get_argparse()
# Put arguments in shape
sourceList, optDict = cmdLineUtils.getSourceListOptDict(parser)
# Process rootRm
return cmdLineUtils.rootRm(sourceList, interactive=optDict["interactive"], \
recursive=optDict["recursive"])
if __name__ == "__main__":
sys.exit(execute())