mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-16 17:20:16 +00:00
adding debug logs for timing
This commit is contained in:
@@ -7,6 +7,7 @@ entry point
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import time
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
@@ -746,6 +747,7 @@ def main():
|
|||||||
LOG.err(e)
|
LOG.err(e)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
t0 = time.time()
|
||||||
try:
|
try:
|
||||||
o = Options()
|
o = Options()
|
||||||
except YamlException as e:
|
except YamlException as e:
|
||||||
@@ -757,32 +759,39 @@ def main():
|
|||||||
|
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('\n\n')
|
LOG.dbg('\n\n')
|
||||||
|
options_time = time.time() - t0
|
||||||
|
|
||||||
ret = True
|
ret = True
|
||||||
|
t0 = time.time()
|
||||||
|
command = ''
|
||||||
try:
|
try:
|
||||||
|
|
||||||
if o.cmd_profiles:
|
if o.cmd_profiles:
|
||||||
# list existing profiles
|
# list existing profiles
|
||||||
|
command = 'profiles'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: profiles')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
cmd_list_profiles(o)
|
cmd_list_profiles(o)
|
||||||
|
|
||||||
elif o.cmd_files:
|
elif o.cmd_files:
|
||||||
# list files for selected profile
|
# list files for selected profile
|
||||||
|
command = 'files'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: files')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
cmd_list_files(o)
|
cmd_list_files(o)
|
||||||
|
|
||||||
elif o.cmd_install:
|
elif o.cmd_install:
|
||||||
# install the dotfiles stored in dotdrop
|
# install the dotfiles stored in dotdrop
|
||||||
|
command = 'install'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: install')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
ret = cmd_install(o)
|
ret = cmd_install(o)
|
||||||
|
|
||||||
elif o.cmd_compare:
|
elif o.cmd_compare:
|
||||||
# compare local dotfiles with dotfiles stored in dotdrop
|
# compare local dotfiles with dotfiles stored in dotdrop
|
||||||
|
command = 'compare'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: compare')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
tmp = get_tmpdir()
|
tmp = get_tmpdir()
|
||||||
ret = cmd_compare(o, tmp)
|
ret = cmd_compare(o, tmp)
|
||||||
# clean tmp directory
|
# clean tmp directory
|
||||||
@@ -790,34 +799,41 @@ def main():
|
|||||||
|
|
||||||
elif o.cmd_import:
|
elif o.cmd_import:
|
||||||
# import dotfile(s)
|
# import dotfile(s)
|
||||||
|
command = 'import'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: import')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
ret = cmd_importer(o)
|
ret = cmd_importer(o)
|
||||||
|
|
||||||
elif o.cmd_update:
|
elif o.cmd_update:
|
||||||
# update a dotfile
|
# update a dotfile
|
||||||
|
command = 'update'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: update')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
ret = cmd_update(o)
|
ret = cmd_update(o)
|
||||||
|
|
||||||
elif o.cmd_detail:
|
elif o.cmd_detail:
|
||||||
# detail files
|
# detail files
|
||||||
|
command = 'detail'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: detail')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
cmd_detail(o)
|
cmd_detail(o)
|
||||||
|
|
||||||
elif o.cmd_remove:
|
elif o.cmd_remove:
|
||||||
# remove dotfile
|
# remove dotfile
|
||||||
|
command = 'remove'
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('running cmd: remove')
|
LOG.dbg('running cmd: {}'.format(command))
|
||||||
cmd_remove(o)
|
cmd_remove(o)
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
LOG.err('interrupted')
|
LOG.err('interrupted')
|
||||||
ret = False
|
ret = False
|
||||||
|
cmd_time = time.time() - t0
|
||||||
|
|
||||||
if o.debug:
|
if o.debug:
|
||||||
LOG.dbg('done executing command')
|
LOG.dbg('done executing command \"{}\"'.format(command))
|
||||||
|
LOG.dbg('options loaded in {}'.format(options_time))
|
||||||
|
LOG.dbg('command executed in {}'.format(cmd_time))
|
||||||
|
|
||||||
if ret and o.conf.save():
|
if ret and o.conf.save():
|
||||||
LOG.log('config file updated')
|
LOG.log('config file updated')
|
||||||
|
|||||||
Reference in New Issue
Block a user