Reconfig project dirs
This commit is contained in:
parent
f5b3bbc1c1
commit
6114d17dc3
3 changed files with 4 additions and 4 deletions
|
@ -1,8 +1,8 @@
|
||||||
import click
|
import click
|
||||||
from project.utils import get_config
|
from project.utils import config
|
||||||
|
|
||||||
|
|
||||||
@click.command('config')
|
@click.command('config')
|
||||||
@click.argument('key')
|
@click.argument('key')
|
||||||
def cli(key):
|
def cli(key):
|
||||||
print(get_config(key))
|
print(config.get(key))
|
||||||
|
|
|
@ -19,12 +19,12 @@ def get_config_data(filename):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CONFIG = get_config_data(os.path.join(BASE_DIR, 'config', 'defaults.yml'))
|
DEFAULT_CONFIG = get_config_data(os.path.join(BASE_DIR, 'defaults.yml'))
|
||||||
|
|
||||||
USER_CONFIG = get_config_data(os.path.expanduser(USER_CONFIG_DIR))
|
USER_CONFIG = get_config_data(os.path.expanduser(USER_CONFIG_DIR))
|
||||||
|
|
||||||
|
|
||||||
def get_config(key):
|
def get(key):
|
||||||
if USER_CONFIG and key in USER_CONFIG:
|
if USER_CONFIG and key in USER_CONFIG:
|
||||||
return USER_CONFIG[key]
|
return USER_CONFIG[key]
|
||||||
elif DEFAULT_CONFIG and key in DEFAULT_CONFIG:
|
elif DEFAULT_CONFIG and key in DEFAULT_CONFIG:
|
Reference in a new issue