@@ -11,17 +11,32 @@ def main():
1111
1212 parser = argparse .ArgumentParser ()
1313
14- template_file_name = "meta-compose.yml"
15- data_file_names = ["meta-compose-data.yml" ]
16-
1714 parser .add_argument (
1815 "-d" , "--datafile" , action = 'append' ,
19- help = "Use to specify data files in addition to meta-compose-data.yml."
20- " They must be JSON or YAML files." )
16+ default = [],
17+ help = "Use to specify data files in addition to meta-compose-data.yml. "
18+ "They must be JSON or YAML files." )
19+
20+ parser .add_argument (
21+ "-t" , "--template" ,
22+ default = "./meta-compose.yml" ,
23+ help = "Use to specify the template file to use. "
24+ "Defaults to ./meta-compose.yml" )
25+
26+ parser .add_argument (
27+ "-o" , "--outputfile" ,
28+ default = "./docker-compose.yml" ,
29+ help = "Use to specify the output file to create. "
30+ "Defaults to ./docker-compose.yml" )
2131
2232 args = parser .parse_args ()
2333
24- data_file_names += args .datafile
34+
35+ template_file_name = args .template
36+ output_file_name = args .outputfile
37+ data_file_names = ["meta-compose-data.yml" ] + args .datafile
38+
39+
2540
2641 jinja = Environment (loader = FileSystemLoader ("." ), undefined = StrictUndefined )
2742 jinja .filters ['env' ] = env_override
@@ -36,5 +51,5 @@ def main():
3651
3752 composition = template .render (data )
3853
39- with open ("docker-compose.yml" , "w" ) as fh :
54+ with open (output_file_name , "w" ) as fh :
4055 fh .write (composition )
0 commit comments