-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·32 lines (24 loc) · 1 KB
/
configure
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
#!/usr/bin/env python3
import click
@click.command(name="configure")
@click.option("--site", "-s", type=str, help="Site Directory")
@click.option("--git", "-git", type=str, default="SSH", help="Git connection type")
@click.option("--amrex", "-amrex", type=str, default="development", help="AMReX branch/tag")
def configure(site, git, amrex):
"""
\b
Configuration command to generate config.sh
from user defined values
"""
if git not in ["SSH", "HTTPS", "ssh", "https"]:
raise ValueError(
'Option --git/-git should contain one of following values: ["SSH", "HTTPS", "ssh", "https"]'
)
print("Generating configuration file")
with open("config.sh", "w") as config_file:
config_file.write("# This file is generated using configuration script\n")
config_file.write(f'SiteName="{site}"\n')
config_file.write(f'GitConnection="{git.upper()}"\n')
config_file.write(f'AMReXBranch="{amrex}"\n')
if __name__ == "__main__":
configure()