uninstall
(opts)
| 626 | |
| 627 | |
| 628 | def 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 | |
| 669 | def cmd_remove(opts): |
no test coverage detected