PEP8
This commit is contained in:
parent
ba732934d0
commit
a9ec77cce0
2 changed files with 5 additions and 2 deletions
|
@ -1,8 +1,8 @@
|
|||
import click
|
||||
from project.utils import get_config
|
||||
|
||||
|
||||
@click.command('config')
|
||||
@click.argument('key')
|
||||
def cli(key):
|
||||
print(get_config(key))
|
||||
pass
|
||||
|
|
|
@ -6,9 +6,11 @@ try:
|
|||
except ImportError:
|
||||
from yaml import Loader
|
||||
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
USER_CONFIG_DIR = "~/.dfa.yml"
|
||||
|
||||
|
||||
def get_config_data(filename):
|
||||
try:
|
||||
config_file = open(filename)
|
||||
|
@ -21,6 +23,7 @@ DEFAULT_CONFIG = get_config_data(os.path.join(BASE_DIR, 'config' ,'defaults.yml'
|
|||
|
||||
USER_CONFIG = get_config_data(os.path.expanduser(USER_CONFIG_DIR))
|
||||
|
||||
|
||||
def get_config(key):
|
||||
if USER_CONFIG and key in USER_CONFIG:
|
||||
return USER_CONFIG[key]
|
||||
|
|
Reference in a new issue