Conditions | 6 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 42 |
Changes | 0 |
1 | # coding: utf-8 |
||
9 | def get_config_from_argv(argv: list): |
||
10 | """Search for a config file option in command line""" |
||
11 | for index, arg in enumerate(argv): |
||
12 | # manage "=" sign |
||
13 | if arg.find('=') != -1 and arg.split('=')[0] == '--config': |
||
14 | return arg.split('=')[1] |
||
15 | |||
16 | # else search for -c or --config and get the next value |
||
17 | if arg in ['-c', '--config']: |
||
18 | try: |
||
19 | return argv[index + 1] |
||
20 | except IndexError: |
||
21 | raise ValueError('You must specify the config file name') |
||
22 | |||
23 | return None |
||
24 | |||
37 |