1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-04 14:31:46 +00:00
This commit is contained in:
deadc0de6
2023-09-20 20:03:54 +02:00
committed by deadc0de
parent 2ce64f8bb5
commit e6bba29e2a
4 changed files with 14 additions and 11 deletions

View File

@@ -622,6 +622,7 @@ def cmd_detail(opts):
def cmd_uninstall(opts): def cmd_uninstall(opts):
"""uninstall"""
dotfiles = opts.dotfiles dotfiles = opts.dotfiles
keys = opts.uninstall_key keys = opts.uninstall_key
@@ -649,15 +650,16 @@ def cmd_uninstall(opts):
debug=opts.debug, debug=opts.debug,
backup_suffix=opts.install_backup_suffix) backup_suffix=opts.install_backup_suffix)
uninstalled = 0 uninstalled = 0
for df in dotfiles: for dotf in dotfiles:
res, msg = uninst.uninstall(df.src, res, msg = uninst.uninstall(dotf.src,
df.dst, dotf.dst,
df.link) dotf.link)
if not res: if not res:
LOG.err(msg) LOG.err(msg)
continue continue
uninstalled += 1 uninstalled += 1
LOG.log(f'\n{uninstalled} dotfile(s) uninstalled.') LOG.log(f'\n{uninstalled} dotfile(s) uninstalled.')
return True
def cmd_remove(opts): def cmd_remove(opts):

View File

@@ -107,7 +107,6 @@ class Uninstaller:
def _remove(self, path): def _remove(self, path):
"""remove path""" """remove path"""
# TODO handle symlink
self.log.dbg(f'handling uninstall of {path}') self.log.dbg(f'handling uninstall of {path}')
if path.endswith(self.backup_suffix): if path.endswith(self.backup_suffix):
self.log.dbg(f'skip {path} ignored') self.log.dbg(f'skip {path} ignored')
@@ -116,8 +115,7 @@ class Uninstaller:
if os.path.exists(backup): if os.path.exists(backup):
self.log.dbg(f'backup exists for {path}: {backup}') self.log.dbg(f'backup exists for {path}: {backup}')
return self._replace(path, backup) return self._replace(path, backup)
else: self.log.dbg(f'no backup file for {path}')
self.log.dbg(f'no backup file for {path}')
if os.path.isdir(path): if os.path.isdir(path):
self.log.dbg(f'{path} is a directory') self.log.dbg(f'{path} is a directory')

View File

@@ -38,10 +38,12 @@ pyflakes --version
# checking for TODO/FIXME # checking for TODO/FIXME
echo "--------------------------------------" echo "--------------------------------------"
echo "checking for TODO/FIXME" echo "checking for TODO/FIXME"
grep -rv 'TODO\|FIXME' dotdrop/ >/dev/null 2>&1 set +e
grep -rv 'TODO\|FIXME' tests/ >/dev/null 2>&1 grep -r 'TODO\|FIXME' dotdrop/ && exit 1
grep -rv 'TODO\|FIXME' tests-ng/ >/dev/null 2>&1 grep -r 'TODO\|FIXME' tests/ && exit 1
grep -rv 'TODO\|FIXME' scripts/ >/dev/null 2>&1 grep -r 'TODO\|FIXME' tests-ng/ && exit 1
#grep -r 'TODO\|FIXME' scripts/ && exit 1
set -e
# checking for tests options # checking for tests options
echo "---------------------------------" echo "---------------------------------"

View File

@@ -27,6 +27,7 @@ echo -e "$(tput setaf 6)==> RUNNING $(basename "${BASH_SOURCE[0]}") <==$(tput sg
################################################################ ################################################################
export DOTDROP_TEST_NG_UNINSTALL_DDPATH="${ddpath}" export DOTDROP_TEST_NG_UNINSTALL_DDPATH="${ddpath}"
export DOTDROP_TEST_NG_UNINSTALL_BIN="${bin}" export DOTDROP_TEST_NG_UNINSTALL_BIN="${bin}"
# shellcheck source=uninstall_
source "${cur}"/uninstall_ source "${cur}"/uninstall_
export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="nolink" export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="nolink"