Skip to content

Instantly share code, notes, and snippets.

@stephenmm
Last active October 16, 2018 22:53
Show Gist options
  • Save stephenmm/48b5912d6c893dd6b077c793c8474fe5 to your computer and use it in GitHub Desktop.
Save stephenmm/48b5912d6c893dd6b077c793c8474fe5 to your computer and use it in GitHub Desktop.
A quick bash script to allow quick indexing of new codebase. Just add this script to the root of the codebase (and then source it of course).
source_file=`pwd`/${BASH_SOURCE[0]}
source_root=$( readlink -f $( dirname $source_file ) )
# Setup so we can easily search the codebase with csearch/cindex
# Make sure csearch and cindex are installed first
if type cindex >/dev/null 2>&1; then
export CSEARCHINDEX=$source_root/.csearchindex.local
if [[ ! -f $CSEARCHINDEX ]]; then
cindex $source_root
fi
else
echo "[WARN] Need to install cindex/csearch in order to index this codebase. Ex: > git clone https://github.com/google/codesearch"
fi
echo '[INFO] If this is a "c" based codebase you could also run "cscope -R *" to create tags which will also help you explore the code.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment