Total Complexity | 2 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
|
|||
2 | # -*- coding: future_fstrings -*- |
||
3 | |||
4 | import argparse, sys, os |
||
5 | from collections import defaultdict |
||
6 | # Workaround for ModuleNotFoundError |
||
7 | sys.path.append(os.getcwd()) |
||
8 | from lighthouse_garden import illuminate |
||
9 | |||
10 | |||
11 | def main(args={}): |
||
12 | """ |
||
13 | Main entry point for the command line. Parse the arguments and call to the main process. |
||
14 | :param args: |
||
15 | :return: |
||
16 | """ |
||
17 | args = get_arguments(args) |
||
18 | illuminate.Lighthouse( |
||
19 | verbose=args.verbose, |
||
20 | config_file=args.config, |
||
21 | clear=args.clear |
||
22 | ) |
||
23 | |||
24 | |||
25 | def get_arguments(args): |
||
26 | """ |
||
27 | Parses and returns script arguments |
||
28 | :param args: |
||
29 | :return: |
||
30 | """ |
||
31 | parser = argparse.ArgumentParser(prog='lighthouse_garden', description='Monitoring performance data by lighthouse.') |
||
32 | parser.add_argument('-v', '--verbose', |
||
33 | help='Enable extended console output', |
||
34 | required=False, |
||
35 | action='store_true') |
||
36 | parser.add_argument('-c', '--config', |
||
37 | help='Path to config file', |
||
38 | required=False, |
||
39 | type=str) |
||
40 | parser.add_argument('--clear', |
||
41 | help='Clear all performance data and reset the application', |
||
42 | required=False, |
||
43 | action='store_true') |
||
44 | |||
45 | return parser.parse_args() |
||
46 | |||
47 | |||
48 | if __name__ == "__main__": |
||
49 | main() |
||
50 |