forked from C-Otto/rebalance-lnd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
86 lines (80 loc) · 2.63 KB
/
test.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import argparse
def main():
argument_parser = get_argument_parser()
arguments = argument_parser.parse_args()
if arguments.command == "bos":
if arguments.run:
print("running bos command with --run")
elif arguments.list:
print("running bos command with --list")
else:
print(argument_parser.format_help())
if arguments.command == "disk":
print("running disk command")
if arguments.command == "rebalances":
print("running rebalances command")
if arguments.list:
print("running rebalances command with --list")
if arguments.command == "htlcs":
print("running htlcs command")
def get_argument_parser():
parent_parser = argparse.ArgumentParser(description="The main script")
parent_parser.add_argument(
"-t",
"--telegram",
action='store_true',
help="output in telegram format",
)
subparsers = parent_parser.add_subparsers(title="commands", dest="command")
parser_bos = subparsers.add_parser("bos", add_help=True, help="run bos rebalances")
group_bos = parser_bos.add_mutually_exclusive_group(required=True)
group_bos.add_argument(
"-l",
"--list",
action='store_true',
help="show running bos rebalances"
)
group_bos.add_argument(
"-r",
"--run",
action='store_true',
help="run bos rebalances",
)
parser_disk = subparsers.add_parser("disk", add_help=False, help="show free disk space")
parser_htlcs = subparsers.add_parser("htlcs", add_help=True, help="show pending HTLCs")
group_htlcs = parser_htlcs.add_mutually_exclusive_group()
group_htlcs.add_argument(
"-l",
"--list",
action='store_true',
help="show list of rebalances"
)
group_htlcs.add_argument(
"-s",
"--summary",
action='store_true',
help="show summary of rebalances",
)
parser_rebalances = subparsers.add_parser("rebalances", add_help=True, help="show past rebalances")
group_rebalances = parser_rebalances.add_mutually_exclusive_group(required=True)
group_rebalances.add_argument(
"-l",
"--list",
action='store_true',
help="show list of rebalances"
)
group_rebalances.add_argument(
"-s",
"--summary",
action='store_true',
help="show summary of rebalances",
)
parser_rebalances.add_argument(
"-d",
"--days",
type=int,
default=7,
help="interval in days (default: 7)",
)
return parent_parser
success = main()