mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-08 20:09:18 +00:00
ensure expanding user when using --files in compare
This commit is contained in:
@@ -153,6 +153,23 @@ def apply_trans(opts, dotfile):
|
|||||||
return new_src
|
return new_src
|
||||||
|
|
||||||
|
|
||||||
|
def _select(selections, dotfiles):
|
||||||
|
ret = True
|
||||||
|
selected = []
|
||||||
|
for selection in selections:
|
||||||
|
df = next(
|
||||||
|
(x for x in dotfiles
|
||||||
|
if os.path.expanduser(x.dst) == os.path.expanduser(selection)),
|
||||||
|
None
|
||||||
|
)
|
||||||
|
if df:
|
||||||
|
selected.append(df)
|
||||||
|
else:
|
||||||
|
LOG.err('no dotfile matches \"{}\"'.format(selection))
|
||||||
|
ret = False
|
||||||
|
return selected, ret
|
||||||
|
|
||||||
|
|
||||||
def compare(opts, conf, tmp, focus=None):
|
def compare(opts, conf, tmp, focus=None):
|
||||||
"""compare dotfiles and return True if all identical"""
|
"""compare dotfiles and return True if all identical"""
|
||||||
dotfiles = conf.get_dotfiles(opts['profile'])
|
dotfiles = conf.get_dotfiles(opts['profile'])
|
||||||
@@ -169,14 +186,7 @@ def compare(opts, conf, tmp, focus=None):
|
|||||||
ret = True
|
ret = True
|
||||||
selected = dotfiles
|
selected = dotfiles
|
||||||
if focus:
|
if focus:
|
||||||
selected = []
|
selected, ret = _select(focus.replace(' ', '').split(','), dotfiles)
|
||||||
for selection in focus.replace(' ', '').split(','):
|
|
||||||
df = next((x for x in dotfiles if x.dst == selection), None)
|
|
||||||
if df:
|
|
||||||
selected.append(df)
|
|
||||||
else:
|
|
||||||
LOG.err('no dotfile matches \"{}\"'.format(selection))
|
|
||||||
ret = False
|
|
||||||
|
|
||||||
if len(selected) < 1:
|
if len(selected) < 1:
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
Reference in New Issue
Block a user