1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-02-19 12:04:54 +00:00

Improve cscope script so it's easier to customize.

It still does the same thing as before.
This commit is contained in:
King_DuckZ 2016-02-28 01:56:38 +00:00
parent b19720548a
commit c69d17395a

View file

@ -1,5 +1,35 @@
#!/usr/bin/env bash
find . \( -path './action_skel_code' -prune -o -path './.git' -prune -o -path './lib' -prune -o -path '*/gtest' -prune -o -name '*.cpp' -o -name '*.inl' -o -name '*.hpp' -o -name '*.h' -o -name '*.c' \) -a -type f > cscope.files
function join {
local separator="$1"
shift
local retval="$( printf "${separator}%s" "$@" )"
retval="${retval:${#separator}}"
echo "${retval}"
}
excl_directories=(
./action_skel_code
./.git
./lib
"*/gtest"
)
excl_paths="-path $(join " -prune -o -path " "${excl_directories[@]}") -prune"
excl_wholefiles=(
)
if [ ${#excl_wholefiles[@]} -gt 0 ]; then
excl_files="-a ! -wholename $(join " -a ! -wholename " "${excl_wholefiles[@]}")"
else
excl_files=""
fi
include_extensions=( cpp inl hpp h c )
incl_extensions="-name *.$(join " -o -name *." "${include_extensions[@]}")"
#Don't expand * - see http://stackoverflow.com/questions/102049/how-do-i-escape-the-wildcard-asterisk-character-in-bash
set -f
find . \( $excl_paths -o $incl_extensions \) -a -type f $excl_files > cscope.files
set +f
cscope -b -q