You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.5 KiB
39 lines
1.5 KiB
4 years ago
|
#! /usr/bin/python3
|
||
|
import argparse
|
||
|
from calculate.templates.template_processor import DirectoryProcessor
|
||
|
from calculate.variables.loader import Datavars
|
||
|
from calculate.utils.io_module import IOModule
|
||
|
from calculate.utils.package import NonePackage
|
||
|
from calculate.utils.tools import flat_iterable
|
||
|
|
||
|
|
||
|
def main():
|
||
|
parser = argparse.ArgumentParser('Run templates.')
|
||
|
parser.add_argument('-a', '--action', action='append', type=str, nargs='+',
|
||
|
help="action parameter value.")
|
||
|
parser.add_argument('-p', '--package', type=str,
|
||
|
help="atom name of a target package.")
|
||
|
parser.add_argument('--dbpkg', action='store_true',
|
||
|
help=("flag for switching template engine's mode from"
|
||
|
" standard mode to the mode allowing changing of"
|
||
|
"CONTENTS files."))
|
||
|
args = parser.parse_args()
|
||
|
datavars = Datavars()
|
||
|
io_module = IOModule()
|
||
|
if args.package == 'None':
|
||
|
package = NonePackage
|
||
|
else:
|
||
|
package = args.package
|
||
|
|
||
|
action = list(flat_iterable(args.action))
|
||
|
template_processor = DirectoryProcessor(action,
|
||
|
datavars_module=datavars,
|
||
|
package=package,
|
||
|
output_module=io_module,
|
||
|
dbpkg=args.dbpkg)
|
||
|
template_processor.process_template_directories()
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
main()
|