forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrootmkdir.py
More file actions
executable file
·48 lines (35 loc) · 1.28 KB
/
rootmkdir.py
File metadata and controls
executable file
·48 lines (35 loc) · 1.28 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: rootmkdir
# Author: Julien Ripoche
# Mail: julien.ripoche@u-psud.fr
# Date: 20/08/15
"""Command line to add directories in ROOT files"""
import cmdLineUtils
import sys
# Help strings
description = "Add directories in ROOT files"
PARENT_HELP = "make parent directories as needed, no error if existing."
EPILOG="""Examples:
- rootmkdir example.root:dir
Add the directory 'dir' to the ROOT file 'example.root'
- rootmkdir example.root:dir1/dir2
Add the directory 'dir2' in 'dir1' which is into the ROOT file 'example.root'
- rootmkdir -p example.root:dir1/dir2/dir3
Make parent directories of 'dir3' as needed, no error if existing
- rootmkdir example.root
Create an empty ROOT file named 'example.root'
"""
def get_argparse():
# Collect arguments with the module argparse
parser = cmdLineUtils.getParserFile(description, EPILOG)
parser.prog = 'rootmkdir'
parser.add_argument("-p", "--parents", help=PARENT_HELP, action="store_true")
return parser
def execute():
parser = get_argparse()
# Put arguments in shape
sourceList, optDict = cmdLineUtils.getSourceListOptDict(parser, wildcards = False)
# Process rootMkdir
return cmdLineUtils.rootMkdir(sourceList, parents=optDict["parents"])
if __name__ == "__main__":
sys.exit(execute())