-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParser.py
22 lines (18 loc) · 868 Bytes
/
Parser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import argparse
from logging import error
class Parser:
def __init__(self, args):
self.args = args.strip().split(" ")
if len(self.args) > 0 and self.args[0].startswith("-"):
self.args.insert(0, "")
self.parser = argparse.ArgumentParser(description='Show the history of names for a person')
self.parser.add_argument("username",
help="The username of the person you are searching for",
type=str, nargs="+"
)
self.parser.add_argument("-m", "--max", default=5, type=int,
help="The maximum number of name to display")
self.parser.add_argument("-n", "--name", action="store_true",
help="If the search is made by name and not nickname")
def parse(self):
return self.parser.parse_known_args(args=self.args)