Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Adams committed Dec 28, 2017
1 parent 275003c commit d1fb87a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 5 additions & 2 deletions clamm/__init__.py
Expand Up @@ -4,6 +4,8 @@


installed_location = os.path.split(__file__)[0]
config_template = os.path.join(
installed_location, "clamm", "templates", "config.json")


def get_config_path():
Expand All @@ -17,8 +19,9 @@ def get_config():
with open(get_config_path()) as fptr:
config = json.load(fptr)
except IOError:
print("Run config init, using empty config for now...")
config = {}
print("Run config init, using default config for now...")
with open(config_template) as fptr:
config = json.load(fptr)

return config

Expand Down
9 changes: 2 additions & 7 deletions clamm/__main__.py
Expand Up @@ -7,7 +7,7 @@
import os
import json

from clamm import config, get_config_path, installed_location
from clamm import config, get_config_path, config_template
from clamm import util


Expand Down Expand Up @@ -254,12 +254,7 @@ def tags_edit(args):
def config_init(args):
"""copy config template to ``$HOME/.config/clamm/config.json``
"""
call([
'cp',
os.path.join(
installed_location, 'clamm', 'templates', 'config.json'),
get_config_path()
])
call(['cp', config_template, get_config_path()])


def config_show(args):
Expand Down

0 comments on commit d1fb87a

Please sign in to comment.