1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 15:39:43 +00:00

refactor the parsing

This commit is contained in:
deadc0de6
2019-05-31 18:30:19 +02:00
parent 18cc3bc2ac
commit 6e6c5fb2e3
33 changed files with 1739 additions and 1486 deletions

View File

@@ -171,8 +171,9 @@ def get_dotfile_from_yaml(dic, path):
"""Return the dotfile from the yaml dictionary"""
# path is not the file in dotpath but on the FS
dotfiles = dic['dotfiles']
src = get_path_strip_version(path)
return [d for d in dotfiles.values() if d['src'] == src][0]
# src = get_path_strip_version(path)
dotfile = [d for d in dotfiles.values() if d['dst'] == path][0]
return dotfile
def yaml_dashed_list(items, indent=0):
@@ -256,10 +257,10 @@ def file_in_yaml(yaml_file, path, link=False):
dotfiles = yaml_conf['dotfiles'].values()
in_src = strip in (x['src'] for x in dotfiles)
in_src = any([x['src'].endswith(strip) for x in dotfiles])
in_dst = path in (os.path.expanduser(x['dst']) for x in dotfiles)
if link:
has_link = get_dotfile_from_yaml(yaml_conf, path)['link']
has_link = 'link' in get_dotfile_from_yaml(yaml_conf, path)
return in_src and in_dst and has_link
return in_src and in_dst