MCPcopy
hub / github.com/deadc0de6/dotdrop / cmd_uninstall

Function cmd_uninstall

dotdrop/dotdrop.py:628–666  ·  view source on GitHub ↗

uninstall

(opts)

Source from the content-addressed store, hash-verified

626
627
628def cmd_uninstall(opts):
629 """uninstall"""
630 dotfiles = opts.dotfiles
631 keys = opts.uninstall_key
632
633 if keys:
634 # uninstall only specific keys for this profile
635 dotfiles = []
636 for key in uniq_list(keys):
637 dotfile = opts.conf.get_dotfile(key)
638 if dotfile:
639 dotfiles.append(dotfile)
640
641 if not dotfiles:
642 msg = f'no dotfile to uninstall for this profile (\"{opts.profile}\")'
643 LOG.warn(msg)
644 return False
645
646 if opts.debug:
647 lfs = [k.key for k in dotfiles]
648 LOG.dbg(f'dotfiles registered for uninstall: {lfs}')
649
650 uninst = Uninstaller(base=opts.dotpath,
651 workdir=opts.workdir,
652 dry=opts.dry,
653 safe=opts.safe,
654 debug=opts.debug,
655 backup_suffix=opts.install_backup_suffix)
656 uninstalled = 0
657 for dotf in dotfiles:
658 res, msg = uninst.uninstall(dotf.src,
659 dotf.dst,
660 dotf.link)
661 if not res:
662 LOG.err(msg)
663 continue
664 uninstalled += 1
665 LOG.log(f'\n{uninstalled} dotfile(s) uninstalled.')
666 return True
667
668
669def cmd_remove(opts):

Callers 1

_exec_commandFunction · 0.85

Calls 8

uninstallMethod · 0.95
uniq_listFunction · 0.90
UninstallerClass · 0.90
get_dotfileMethod · 0.80
warnMethod · 0.80
dbgMethod · 0.80
errMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected