mirror of
https://github.com/prurigro/darkcloud-vimconfig.git
synced 2024-11-25 16:01:25 -05:00
Clean up the gentags script
This commit is contained in:
parent
b5368c4d34
commit
d7bff08bc0
1 changed files with 14 additions and 10 deletions
24
gentags
24
gentags
|
@ -1,22 +1,26 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
TAGS_FILE="${HOME}/.vim/tags"
|
tags_file="$HOME/.vim/tags"
|
||||||
CTAGS_CMD="ctags --fields=+l --c-kinds=+p --c++-kinds=+p -R -f ${TAGS_FILE}"
|
ctags_cmd="ctags --fields=+l --c-kinds=+p --c++-kinds=+p -R -f $tags_file"
|
||||||
|
|
||||||
|
function generate_tags() {
|
||||||
|
printf '%s\n' 'Recursively generating tags for the following paths:'
|
||||||
|
|
||||||
function generate_tags(){
|
|
||||||
echo -e "\nRecursively generating tags for the following paths:"
|
|
||||||
for path in "$@"; do
|
for path in "$@"; do
|
||||||
echo " ${path}"
|
printf '%s\n' " $path"
|
||||||
done
|
done
|
||||||
RESULT=$($CTAGS_CMD "$@" >/dev/null 2>&1) && echo -e "Done!\n" || echo -e "Failed! Look at ${TAGS_FILE}.log for details.\n"
|
|
||||||
if [[ -n "$RESULT" ]]; then
|
if $ctags_cmd "$@" >/dev/null 2>&1; then
|
||||||
echo "$RESULT" >> "${TAGS_FILE}.log"
|
printf '%s\n' 'Done!'
|
||||||
|
else
|
||||||
|
printf '%s\n' 'Failed!'
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $(type -P ctags) ]]; then
|
if command -v ctags >/dev/null; then
|
||||||
[[ -n "$1" ]] && generate_tags "$@" || generate_tags "$PWD"
|
[[ -n "$1" ]] && generate_tags "$@" || generate_tags "$PWD"
|
||||||
else
|
else
|
||||||
echo 'Error: cannot find the ctags binary in $PATH'
|
printf '%s\n' 'Error: cannot find the ctags binary in $PATH'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue