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

Function _exec_command

dotdrop/dotdrop.py:852–923  ·  view source on GitHub ↗

execute command

(opts)

Source from the content-addressed store, hash-verified

850###########################################################
851
852def _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

Callers 1

mainFunction · 0.85

Calls 13

get_tmpdirFunction · 0.90
removepathFunction · 0.90
cmd_list_profilesFunction · 0.85
cmd_filesFunction · 0.85
cmd_installFunction · 0.85
cmd_compareFunction · 0.85
cmd_importerFunction · 0.85
cmd_updateFunction · 0.85
cmd_detailFunction · 0.85
cmd_removeFunction · 0.85
cmd_uninstallFunction · 0.85
dbgMethod · 0.80

Tested by

no test coverage detected