diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-11 08:57:27 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-11 08:57:27 -0400 |
commit | b682d9e3c11f94a9a9dc254a6d53e44f953a74bf (patch) | |
tree | cbc2652af24d5e8f22224b0f0fc0186a0df312f6 /tools | |
parent | ed39c3ef1c1820b4d48cecb776fcdb4a772f3ce1 (diff) | |
download | bcfg2-b682d9e3c11f94a9a9dc254a6d53e44f953a74bf.tar.gz bcfg2-b682d9e3c11f94a9a9dc254a6d53e44f953a74bf.tar.bz2 bcfg2-b682d9e3c11f94a9a9dc254a6d53e44f953a74bf.zip |
tools: added script to generate ctags/etags indexes
Diffstat (limited to 'tools')
-rw-r--r-- | tools/README | 3 | ||||
-rwxr-xr-x | tools/ctags.sh | 48 |
2 files changed, 51 insertions, 0 deletions
diff --git a/tools/README b/tools/README index 183e42075..7cae4409d 100644 --- a/tools/README +++ b/tools/README @@ -37,6 +37,9 @@ create-debian-pkglist.py create-rpm-pkglist.py - Generate list of installed RPM packages +ctags.sh + - Generate ctags (or etags) indexes for the Bcfg2 source + encap-util-count.sh - Produce a count of encap packages per directory diff --git a/tools/ctags.sh b/tools/ctags.sh new file mode 100755 index 000000000..bdae00a3f --- /dev/null +++ b/tools/ctags.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +usage() { + echo "$(basename $0) [-e] [-o <outfile>] [-s <source dir>]" + echo " -e: etags mode" + echo " -o <outfile>: Write to <outfile>. Default is tags or TAGS in the" + echo " default source dir" + echo " -s <source dir>: Find Bcfg2 source directory. Default is the " + echo " parent of the directory where $(basename $0) lives" + exit 1 +} + +# compute the path to the parent directory of tools/ +SRCDIR=$(pwd)/$(dirname $0)/.. + +CTAGS=ctags +ETAGS= +CTAGS_ARGS= +OUTFILE="$SRCDIR/TAGS" + +while getopts ":eho:s:" opt; do + case $opt in + e) + ETAGS=1 + CTAGS_ARGS="$CTAGS_ARGS -e" + ;; + h) + usage + ;; + o) + $OUTFILE=$OPTARG + ;; + s) + $SRCDIR=$OPTARG + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + usage + ;; + esac +done + +CTAGS_ARGS="$CTAGS_ARGS -f $OUTFILE" + +find "$SRCDIR/testsuite" "$SRCDIR/tools" "$SRCDIR/src/lib" -name \*.py | \ + xargs "$CTAGS" $CTAGS_ARGS +find "$SRCDIR/src/sbin" | xargs "$CTAGS" $CTAGS_ARGS --append + |