aboutsummaryrefslogtreecommitdiffstats
path: root/tagger.sh
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
committerterminaldweller <thabogre@gmail.com>2021-05-14 18:14:50 +0000
commit6e528248414e330c9e25e81596ab47b8b8a5b701 (patch)
treee1aa41a7f3198eeac187e6177ec7d4a33db229d3 /tagger.sh
downloadscripts-6e528248414e330c9e25e81596ab47b8b8a5b701.tar.gz
scripts-6e528248414e330c9e25e81596ab47b8b8a5b701.zip
first commitmaster
Diffstat (limited to 'tagger.sh')
-rwxr-xr-xtagger.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/tagger.sh b/tagger.sh
new file mode 100755
index 0000000..f0b0d17
--- /dev/null
+++ b/tagger.sh
@@ -0,0 +1,60 @@
+#!/usr/bin/sh
+
+CC=clang
+CXX=clang++
+C_EXT=c
+CXX_EXT=cpp
+EXTENSION=
+CTAGS_I_PATH=./
+RECURSIVE=false
+while [[ $# -gt 0 ]]
+do
+ passarg="$1"
+ case $passarg in
+ --dir)
+ CTAGS_I_PATH="$2"
+ shift
+ ;;
+ --lang)
+ LANG="$2"
+ shift
+ ;;
+ --cc)
+ CC="$2"
+ shift
+ ;;
+ --cxx)
+ CXX="$2"
+ shift
+ ;;
+ --recursive|-r)
+ RECURSIVE=true
+ ;;
+ --ex)
+ EXTENSION="$2"
+ shift
+ ;;
+ esac
+ shift
+done
+
+if [[ $LANG == "c" ]];then
+ if [[ $EXTENSION == "" ]];then
+ EXTENSION="c"
+ fi
+elif [[ $LANG == "cpp" ]];then
+ if [[ $EXTENSION == "" ]];then
+ EXTENSION="cpp"
+ fi
+fi
+
+for file in $CTAGS_I_PATH/*.$EXTENSION;do
+ TEMP_FILE=$(mktemp)
+ echo $file > $TEMP_FILE
+done
+
+if [[ $LANG == "cpp" ]];then
+ $CXX -c -I $CTAGS_I_PATH -M $TEMP_FILE| sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q
+elif [[ $LANG == "c" ]];then
+ $CC -c -I $CTAGS_I_PATH -M $TEMP_FILE|sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q
+fi