forked from MusheAbdulHakim/Bitcoin-Notifier
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.py
More file actions
74 lines (58 loc) · 1.96 KB
/
cli.py
File metadata and controls
74 lines (58 loc) · 1.96 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import optparse
parser = optparse.OptionParser()
class Cli():
def __init__(self):
self.time = 5
self.currency = 'usd'
self.getCurrencies = False
self.getCoins = False
self.time_type = ''
self.crypto = ''
self.argument_parser()
def argument_parser(self):
parser.add_option(
"-T",
"--time",
dest="time",
help="Set timer for notifications."
)
parser.add_option(
"-t",
"--timetype",
dest="timeType",
help="Set timer type ('seconds' or 'minutes')."
)
parser.add_option(
'-c',
"--coin",
dest="cryptoCoin",
help="Specify the crypto currency you want."
)
parser.add_option(
"-L",
"--listcoins",
dest="CoinsList",
help="Get all supported coins. Takes a boolearn (True or False)"
)
parser.add_option(
'-l',
"--listcurrency",
dest="Currencies",
help="Get list of supported curriencies.Takes a boolearn (True or False)"
)
(options,arguments) = parser.parse_args()
self.time = options.time
self.time_type = options.timeType
self.crypto = options.cryptoCoin
get_coins = options.CoinsList
get_currencies = options.Currencies
if get_coins != None:
self.getCoins = get_coins
if get_currencies != None:
self.getCurrencies = get_currencies
if self.time_type != None:
if self.time_type.lower() == 'seconds' or self.time_type.lower() == 's':
self.time_type = 'seconds'
if self.time_type.lower() =='minutes' or self.time_type.lower() == 'm':
self.time_type = 'minutes'
return self.time,self.time_type,self.crypto,self.getCurrencies,self.getCoins