risotto/sbin/risotto_templates

35 lines
912 B
Text
Raw Permalink Normal View History

2022-12-21 16:35:58 +01:00
#!/usr/bin/env python3
from argparse import ArgumentParser
from traceback import print_exc
2023-02-27 14:03:56 +01:00
from risotto.machine import remove_cache, build_files, INSTALL_DIR
2022-12-21 16:35:58 +01:00
2023-06-22 16:19:44 +02:00
def main():
2022-12-21 16:35:58 +01:00
parser = ArgumentParser()
2023-02-27 14:03:56 +01:00
parser.add_argument('server_name', nargs='?')
2022-12-21 16:35:58 +01:00
parser.add_argument('--nocache', action='store_true')
parser.add_argument('--debug', action='store_true')
2023-01-23 20:23:32 +01:00
parser.add_argument('--copy_tests', action='store_true')
parser.add_argument('--template')
2022-12-21 16:35:58 +01:00
args = parser.parse_args()
if args.nocache:
remove_cache()
try:
2023-06-22 16:19:44 +02:00
build_files(None,
args.server_name,
False,
args.copy_tests,
template=args.template,
)
2022-12-21 16:35:58 +01:00
except Exception as err:
if args.debug:
print_exc()
exit(err)
2023-02-27 14:03:56 +01:00
print(f'templates generated in "{INSTALL_DIR}" directory')
2022-12-21 16:35:58 +01:00
2023-06-22 16:19:44 +02:00
main()