-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (23 loc) · 955 Bytes
/
main.py
File metadata and controls
30 lines (23 loc) · 955 Bytes
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
import argparse
import logging
from pathlib import Path
from google_forms import create_google_apps_script
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('markdown_file', type=str,
help='path to markdown file')
parser.add_argument('-l', '--log_level', type=str, default='warning',
choices=('debug', 'info', 'warning', 'error', 'critical'),
help='log level')
args = parser.parse_args()
int_log_level = {
'debug': logging.DEBUG, # 10
'info': logging.INFO, # 20
'warning': logging.WARNING, # 30
'error': logging.ERROR, # 40
'critical': logging.CRITICAL, # 50
}[args.log_level]
logging.basicConfig(level=int_log_level)
markdown_file_path = Path(args.markdown_file)
markdown_file = markdown_file_path.read_text()
print(create_google_apps_script(markdown_file))