1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-05 12:38:50 +00:00

add remove tests and fix bugs

This commit is contained in:
deadc0de6
2019-06-04 23:42:49 +02:00
parent f5a0c65df2
commit b7f5495f09
2 changed files with 143 additions and 5 deletions

View File

@@ -420,17 +420,13 @@ def cmd_remove(o):
LOG.log('no dotfile to remove')
return False
if o.debug:
LOG.dbg('dotfile to remove: {}'.format(paths))
LOG.dbg('dotfile(s) to remove: {}'.format(','.join(paths)))
removed = []
for key in paths:
if o.debug:
LOG.dbg('removing {}'.format(key))
if not iskey:
# by path
print(key)
dotfile = o.conf.get_dotfile_by_dst(key)
print(dotfile)
if not dotfile:
LOG.warn('{} ignored, does not exist'.format(key))
continue
@@ -438,7 +434,13 @@ def cmd_remove(o):
else:
# by key
dotfile = o.conf.get_dotfile(key)
if not dotfile:
LOG.warn('{} ignored, does not exist'.format(key))
continue
k = key
if o.debug:
LOG.dbg('removing {}'.format(key))
# make sure is part of the profile
if dotfile.key not in [d.key for d in o.dotfiles]:
LOG.warn('{} ignored, not associated to this profile'.format(key))