Scripts in bin: added -help to scripts

This commit is contained in:
Chris Greenshields
2017-05-29 21:24:29 +01:00
parent 868a6ddfba
commit 8f41539743
2 changed files with 58 additions and 24 deletions

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -31,23 +31,40 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$ sourcesFile=${TMPDIR:-/tmp}/sourcesFile.$$
if [ $# -ne 0 ] usage() {
then cat <<USAGE
echo "Usage : ${0##*/}"
echo "" Usage: ${0##*/}
echo "Build the Ebrowse database for all the .H and .C files" options:
echo "" -help | -h help
exit 1
fi Build the Ebrowse database for all the .H and .C files
USAGE
}
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage && exit 0
;;
*)
usage && exit 1
;;
esac
done
# Clean up on termination and on Ctrl-C # Clean up on termination and on Ctrl-C
trap 'rm -f $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT trap 'rm -f $sourcesFile 2>/dev/null; exit 0' EXIT TERM INT
cd $WM_PROJECT_DIR cd "$WM_PROJECT_DIR"
mkdir .tags 2>/dev/null mkdir .tags 2>/dev/null
cd .tags cd .tags
find -H .. \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) -print > $sourcesFile find -H .. \
ebrowse --files=$sourcesFile --output-file=ebrowse \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) \
-print > "$sourcesFile"
ebrowse --files="$sourcesFile" --output-file=ebrowse
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -37,30 +37,47 @@
# #
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
if [ $# -ne 0 ] usage() {
then cat <<USAGE
echo "Usage : ${0##*/}"
echo "" Usage: ${0##*/}
echo "Build the tags files for all the .C and .H files" options:
echo "" -help | -h help
exit 1
fi Build the tags files for all the .C and .H files
USAGE
}
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage && exit 0
;;
*)
usage && exit 1
;;
esac
done
for cmd in etags ctags-exuberant for cmd in etags ctags-exuberant
do do
type $cmd >/dev/null 2>&1 || { command -v $cmd >/dev/null 2>&1 || {
echo "${0##*/} cannot build tag files: '$cmd' command not found" echo "${0##*/} cannot build tag files: '$cmd' command not found"
exit 1 exit 1
} }
done done
cd $WM_PROJECT_DIR || exit 1 cd "$WM_PROJECT_DIR" || exit 1
mkdir .tags 2>/dev/null mkdir .tags 2>/dev/null
#etagsCmd="etags --declarations -l c++ -o .tags/etags -" #etagsCmd="etags --declarations -l c++ -o .tags/etags -"
etagsCmd="ctags-exuberant -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -" etagsCmd="ctags-exuberant -e --extra=+fq --file-scope=no --c-kinds=+p -o .tags/etags -L -"
find -H $WM_PROJECT_DIR \( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | $etagsCmd find -H "$WM_PROJECT_DIR" \
\( -name "*.[HC]" -o -name lnInclude -prune -o -name Doxygen -prune \) | \
$etagsCmd
#gtags -i --gtagsconf bin/tools/gtagsrc .tags #gtags -i --gtagsconf bin/tools/gtagsrc .tags