-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharg_parser.py
53 lines (51 loc) · 1.37 KB
/
arg_parser.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
53
import argparse
from iotscp.core.sccertificate import (
DEFAULT_SEGMENTS,
DEFAULT_SEGMENT_LENGTH
)
# LANG = "eng"
def parse_args():
parser = argparse.ArgumentParser(
description="Start the IOTSCP device defined in `userdevice.py`"
)
parser.add_argument(
"action",
help=(
"The action you would like to perform "
"`start` starts the device server "
"`get_cert` creates a new certificate "
),
choices=["start", "get_cert"]
)
parser.add_argument(
"--certsize",
default=[DEFAULT_SEGMENTS, DEFAULT_SEGMENT_LENGTH],
nargs=2,
type=int,
help=(
"The size of the certificate to be generated. "
"--certsize 1000 1500 would create a certificate with 1000, 1500 "
"character segments"
)
)
parser.add_argument(
"--port",
default=8000,
type=int,
help=(
"The port that the HTTP server should listen on. "
"Defaults to 8000"
),
)
parser.add_argument(
"--loglvl",
default="INFO",
help="The level to log at. Defaults to INFO",
choices=["DEBUG", "INFO", "ERROR"]
)
parser.add_argument(
"--logfile",
default="",
help="The file to log to. Defaults to stdout"
)
return parser.parse_args()