Coverage for src/args.py: 88%
24 statements
« prev ^ index » next coverage.py v7.3.0, created at 2024-11-20 12:27 +0000
« prev ^ index » next coverage.py v7.3.0, created at 2024-11-20 12:27 +0000
1import argparse
2import logging
5logger = logging.getLogger('blog')
6parser = argparse.ArgumentParser(
7 'src.scripts.build',
8 description='Build the website to the local file system',
9)
10group = parser.add_argument_group('Run options')
11group.add_argument(
12 '--verbose',
13 default=False,
14 action='store_true',
15 help='print debug logs'
16)
18group = parser.add_argument_group('Directories')
19group.add_argument('--dir-www', default='./www')
20group.add_argument('--dir-entries', default='./entries')
21group.add_argument('--dir-pages', default='./pages')
22group.add_argument('--dir-templates', default='./templates')
23group.add_argument('--dir-images', default='./www/images')
24group.add_argument('--dir-data', default='./data')
26group = parser.add_argument_group('Site Options')
27group.add_argument('--site-title', required=True)
28group.add_argument('--site-description', required=True)
29group.add_argument('--site-protocol', default='https')
30group.add_argument('--site-domain', required=True)
31group.add_argument('--site-author', required=True)
32group.add_argument('--site-email', required=True)
35def load_args() -> argparse.Namespace:
36 """
37 Load the system args against the standard website parser.
39 ```python
40 args = src.load_args()
41 logger.debug('called with args = %s', vars(args))
42 ```
43 """
44 result = parser.parse_args()
45 logger.info('loading system args %s', vars(result))
46 return result