Total Complexity | 5 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | #!/usr/bin/env python3 |
||
|
|||
2 | # -*- coding: future_fstrings -*- |
||
3 | |||
4 | from lighthouse_garden import info |
||
5 | from lighthouse_garden.utility import output, system |
||
6 | |||
7 | |||
8 | def print_header(): |
||
9 | """ |
||
10 | Printing console header |
||
11 | :return: |
||
12 | """ |
||
13 | print(f'{output.CliFormat.BLACK}#################################################{output.CliFormat.ENDC}') |
||
14 | print(f'{output.CliFormat.BLACK}# #{output.CliFormat.ENDC}') |
||
15 | print(f'{output.CliFormat.BLACK}#{output.CliFormat.ENDC} LIGHTHOUSE GARDEN {output.CliFormat.BLACK}#{output.CliFormat.ENDC}') |
||
16 | print(f'{output.CliFormat.BLACK}# v{info.__version__} #{output.CliFormat.ENDC}') |
||
17 | print(f'{output.CliFormat.BLACK}# {info.__homepage__} #{output.CliFormat.ENDC}') |
||
18 | print(f'{output.CliFormat.BLACK}# #{output.CliFormat.ENDC}') |
||
19 | print(f'{output.CliFormat.BLACK}#################################################{output.CliFormat.ENDC}') |
||
20 | |||
21 | |||
22 | def print_footer(): |
||
23 | """ |
||
24 | Printing console footer |
||
25 | :return: |
||
26 | """ |
||
27 | if 'errors' in system.config: |
||
28 | output.println(f'{output.Subject.WARNING} Errors occurred during execution, see console output for more information') |
||
29 | else: |
||
30 | output.println(f'{output.Subject.OK} Successfully fetched lighthouse data') |
||
31 | |||
32 | |||
33 | def get_target_name(target): |
||
34 | """ |
||
35 | Get the pretty target name |
||
36 | :param target: Dict |
||
37 | :return: |
||
38 | """ |
||
39 | _name = target['url'] |
||
40 | if 'title' in target: |
||
41 | _name = f'{target["title"]} ({_name})' |
||
42 | return _name |
||
43 |