Mercurial > vim-gutentags
changeset 196:cac059bce038
Log instead of echoing to stdout
author | Chayoung You <yousbe@gmail.com> |
---|---|
date | Wed, 19 Jul 2017 14:24:00 +0900 |
parents | fd863d1bcfb9 |
children | eec9b72fe3df |
files | autoload/gutentags/cscope.vim plat/win32/update_scopedb.cmd |
diffstat | 2 files changed, 27 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/autoload/gutentags/cscope.vim Wed Jul 19 14:23:20 2017 +0900 +++ b/autoload/gutentags/cscope.vim Wed Jul 19 14:24:00 2017 +0900 @@ -24,6 +24,7 @@ " Gutentags Module Interface {{{ let s:runner_exe = gutentags#get_plat_file('update_scopedb') +let s:unix_redir = (&shellredir =~# '%s') ? &shellredir : &shellredir . ' %s' let s:added_dbs = [] function! gutentags#cscope#init(project_root) abort @@ -60,6 +61,17 @@ if !empty(l:file_list_cmd) let l:cmd .= ' -L "' . l:file_list_cmd . '"' endif + if g:gutentags_trace + if has('win32') + let l:cmd .= ' -l "' . a:tags_file . '.log"' + else + let l:cmd .= ' ' . printf(s:unix_redir, '"' . a:tags_file . '.log"') + endif + else + if !has('win32') + let l:cmd .= ' ' . printf(s:unix_redir, '/dev/null') + endif + endif let l:cmd .= ' ' let l:cmd .= gutentags#get_execute_cmd_suffix()
--- a/plat/win32/update_scopedb.cmd Wed Jul 19 14:23:20 2017 +0900 +++ b/plat/win32/update_scopedb.cmd Wed Jul 19 14:24:00 2017 +0900 @@ -9,6 +9,7 @@ set CSCOPE_ARGS= set DB_FILE=cscope.out set FILE_LIST_CMD= +set LOG_FILE= :ParseArgs if [%1]==[] goto :DoneParseArgs @@ -32,6 +33,11 @@ shift goto :LoopParseArgs ) +if [%1]==[-l] ( + set LOG_FILE=%~2 + shift + goto :LoopParseArgs +) echo Invalid Argument: %1 goto :Usage @@ -46,10 +52,12 @@ rem GENERATE DATABASE rem ========================================== -echo Locking db file +if [%LOG_FILE%]==[] set LOG_FILE=CON + +echo Locking db file > %LOG_FILE% echo locked > "%DB_FILE%.lock" -echo Running cscope +echo Running cscope >> %LOG_FILE% if NOT ["%FILE_LIST_CMD%"]==[""] ( if ["%PROJECT_ROOT%"]==["."] ( call %FILE_LIST_CMD% > %DB_FILE%.files @@ -64,16 +72,16 @@ ) "%CSCOPE_EXE%" %CSCOPE_ARGS% -b -k -f "%DB_FILE%" if ERRORLEVEL 1 ( - echo ERROR: Cscope executable returned non-zero code. + echo ERROR: Cscope executable returned non-zero code. >> %LOG_FILE% ) -echo Unlocking db file +echo Unlocking db file >> %LOG_FILE% del /F "%DB_FILE%.files" "%DB_FILE%.lock" if ERRORLEVEL 1 ( - echo ERROR: Unable to remove file lock. + echo ERROR: Unable to remove file lock. >> %LOG_FILE% ) -echo Done. +echo Done. >> %LOG_FILE% goto :EOF @@ -90,5 +98,6 @@ echo -f [file=scope.out]: The path to the database file to create echo -p [dir=]: The path to the project root echo -L [cmd=]: The file list command to run +echo -l [log=]: The log file to output to echo.