execute command
(opts)
| 850 | ########################################################### |
| 851 | |
| 852 | def _exec_command(opts): |
| 853 | """execute command""" |
| 854 | ret = True |
| 855 | command = '' |
| 856 | try: |
| 857 | |
| 858 | if opts.cmd_profiles: |
| 859 | # list existing profiles |
| 860 | command = 'profiles' |
| 861 | LOG.dbg(f'running cmd: {command}') |
| 862 | cmd_list_profiles(opts) |
| 863 | |
| 864 | elif opts.cmd_files: |
| 865 | # list files for selected profile |
| 866 | command = 'files' |
| 867 | LOG.dbg(f'running cmd: {command}') |
| 868 | cmd_files(opts) |
| 869 | |
| 870 | elif opts.cmd_install: |
| 871 | # install the dotfiles stored in dotdrop |
| 872 | command = 'install' |
| 873 | LOG.dbg(f'running cmd: {command}') |
| 874 | ret = cmd_install(opts) |
| 875 | |
| 876 | elif opts.cmd_compare: |
| 877 | # compare local dotfiles with dotfiles stored in dotdrop |
| 878 | command = 'compare' |
| 879 | LOG.dbg(f'running cmd: {command}') |
| 880 | tmp = get_tmpdir() |
| 881 | ret = cmd_compare(opts, tmp) |
| 882 | # clean tmp directory |
| 883 | # ignore any error |
| 884 | removepath(tmp, logger=LOG) |
| 885 | |
| 886 | elif opts.cmd_import: |
| 887 | # import dotfile(s) |
| 888 | command = 'import' |
| 889 | LOG.dbg(f'running cmd: {command}') |
| 890 | ret = cmd_importer(opts) |
| 891 | |
| 892 | elif opts.cmd_update: |
| 893 | # update a dotfile |
| 894 | command = 'update' |
| 895 | LOG.dbg(f'running cmd: {command}') |
| 896 | ret = cmd_update(opts) |
| 897 | |
| 898 | elif opts.cmd_detail: |
| 899 | # detail files |
| 900 | command = 'detail' |
| 901 | LOG.dbg(f'running cmd: {command}') |
| 902 | cmd_detail(opts) |
| 903 | |
| 904 | elif opts.cmd_remove: |
| 905 | # remove dotfile |
| 906 | command = 'remove' |
| 907 | LOG.dbg(f'running cmd: {command}') |
| 908 | cmd_remove(opts) |
| 909 |
no test coverage detected