mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-05 20:48:00 +00:00
adding "remove" option for #47 and fix a few issues/bugs
This commit is contained in:
@@ -136,6 +136,7 @@ def _fake_args():
|
||||
args['import'] = False
|
||||
args['update'] = False
|
||||
args['detail'] = False
|
||||
args['remove'] = False
|
||||
return args
|
||||
|
||||
|
||||
@@ -172,8 +173,13 @@ def get_dotfile_from_yaml(dic, path):
|
||||
# path is not the file in dotpath but on the FS
|
||||
dotfiles = dic['dotfiles']
|
||||
# src = get_path_strip_version(path)
|
||||
dotfile = [d for d in dotfiles.values() if d['dst'] == path][0]
|
||||
return dotfile
|
||||
home = os.path.expanduser('~')
|
||||
if path.startswith(home):
|
||||
path = path.replace(home, '~')
|
||||
dotfile = [d for d in dotfiles.values() if d['dst'] == path]
|
||||
if dotfile:
|
||||
return dotfile[0]
|
||||
return None
|
||||
|
||||
|
||||
def yaml_dashed_list(items, indent=0):
|
||||
@@ -261,6 +267,11 @@ def file_in_yaml(yaml_file, path, link=False):
|
||||
in_dst = path in (os.path.expanduser(x['dst']) for x in dotfiles)
|
||||
|
||||
if link:
|
||||
has_link = 'link' in get_dotfile_from_yaml(yaml_conf, path)
|
||||
df = get_dotfile_from_yaml(yaml_conf, path)
|
||||
has_link = False
|
||||
if df:
|
||||
has_link = 'link' in df
|
||||
else:
|
||||
return False
|
||||
return in_src and in_dst and has_link
|
||||
return in_src and in_dst
|
||||
|
||||
@@ -352,7 +352,7 @@ class TestImport(unittest.TestCase):
|
||||
self.assertFalse(any(a.endswith('ing') for a in actions))
|
||||
|
||||
# testing transformations
|
||||
transformations = y['trans_read'].keys()
|
||||
transformations = y['trans'].keys()
|
||||
self.assertTrue(all(t.endswith('ed') for t in transformations))
|
||||
self.assertFalse(any(t.endswith('ing') for t in transformations))
|
||||
transformations = y['trans_write'].keys()
|
||||
@@ -394,7 +394,7 @@ class TestImport(unittest.TestCase):
|
||||
self.assertFalse(any(action.endswith('ed') for action in actions))
|
||||
|
||||
# testing transformations
|
||||
transformations = y['trans_read'].keys()
|
||||
transformations = y['trans'].keys()
|
||||
self.assertTrue(all(t.endswith('ing') for t in transformations))
|
||||
self.assertFalse(any(t.endswith('ed') for t in transformations))
|
||||
transformations = y['trans_write'].keys()
|
||||
|
||||
@@ -486,7 +486,6 @@ exec bspwm
|
||||
# ensure dst is link
|
||||
self.assertTrue(os.path.islink(dst))
|
||||
# ensure dst not directly linked to src
|
||||
# TODO: maybe check that its actually linked to template folder
|
||||
self.assertNotEqual(os.path.realpath(dst), src)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user