-
Notifications
You must be signed in to change notification settings - Fork 29
/
settings.py
52 lines (43 loc) · 1.92 KB
/
settings.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# settings.py
# -*- coding: utf-8 -*-
#
# The python script in this file makes the various parts of a model planisphere.
#
# Copyright (C) 2014-2024 Dominic Ford <https://dcford.org.uk/>
#
# This code is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# You should have received a copy of the GNU General Public License along with
# this file; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA
# ----------------------------------------------------------------------------
"""
Define a common command-line interface which is shared between all the scripts.
"""
import argparse
from typing import Dict, Union
def fetch_command_line_arguments(default_filename: str = '') -> Dict[str, Union[int, str]]:
"""
Read input parameters from the command line
:return:
Dictionary of command-line arguments
"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--latitude', dest='latitude', type=int, default=52,
help="The latitude to create a planisphere for.")
parser.add_argument('--format', dest='img_format', choices=["pdf", "png", "svg"], default="png",
help="The image format to create.")
parser.add_argument('--output', dest='filename', default=default_filename,
help="Filename for output, without a file type suffix.")
parser.add_argument('--theme', dest='theme', choices=["default", "dark"], default="default",
help="Color theme to be used in the planisphere.")
args = parser.parse_args()
return {
"latitude": args.latitude,
"img_format": args.img_format,
"filename": args.filename,
"theme": args.theme
}