Commit ff5137e4 authored by Mark Olesen's avatar Mark Olesen
Browse files

more consistent naming convention for aliases

- old-style (left untouched for now):
  app, lib, run, sol, tut, util

- new-style:
  foamApps, foamLib, foamRun, foamSol, foamTut, foamUtils

- additional aliases:
  userApps, whichFoam

NB: ideally we'd have 'foamSrc' instead of 'src'.
    Do we really need 'foamsrc' and 'foamfv' anyhow?
parent d749aac0
......@@ -32,34 +32,47 @@
# Prints its argument (which should be a ':' separated path)
# without all
# - duplicate elements
# - (if '-strip') non-accessible directories
# - elements whose start matches a wildcard
# - inaccessible directories (with the -strip option)
#
# Note:
# - this routine will fail when directories have embedded spaces
# - false matches possible if a wildcard contains '.' (sed regex)
#------------------------------------------------------------------------------
if [ "$#" -lt 1 -o "$1" = "-h" -o "$1" = "-help" ]
then
cat <<USAGE 1>&2
Usage: ${0##*/} [-strip] path [wildcard] .. [wildcard]
Prints its argument (which should be a ':' separated list) cleansed from
- duplicate elements
- elements whose start matches one of the wildcard(s)
- (if '-strip') non-accessible directories
usage() {
cat <<USAGE 1>&2
usage: ${0##*/} [-strip] path [wildcard] .. [wildcard]
Prints its argument (which should be a ':' separated list) cleansed from
- duplicate elements
- elements whose start matches one of the wildcard(s)
- inaccessible directories (with the -strip option)
USAGE
exit 1
fi
exit 1
}
strip=''
if [ "$1" = "-strip" ]
then
strip=true
shift
fi
unset strip
# parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help)
usage
;;
-strip)
strip=true
shift
;;
*)
break
;;
esac
done
[ "$#" -ge 1 ] || usage
dirList="$1"
shift
......@@ -79,7 +92,7 @@ do
wildcard=$1
shift
##DEBUG echo "remove>$wildcard<" 1>&2
dirList=`echo "$dirList" | sed -e "s@${wildcard}[^:]*:@@g"`
dirList=$(echo "$dirList" | sed -e "s@${wildcard}[^:]*:@@g")
done
# split on ':' (and on space as well to avoid any surprises)
......@@ -97,13 +110,13 @@ do
if [ -e "$dir" ]
then
#- no duplicate dirs
duplicate=`echo " $dirList " | sed -ne "s@ $dir @DUP@p"`
duplicate=$(echo " $dirList " | sed -ne "s@ $dir @DUP@p")
if [ ! "$duplicate" ]
then
dirList="$dirList $dir"
fi
elif [ "$strip" != "true" ]
elif [ "$strip" != true ]
then
# Print non-existing directories if not in 'strip' mode.
dirList="$dirList $dir"
......
......@@ -46,16 +46,28 @@ alias wmSchedOFF 'unsetenv WM_SCHEDULER'
# Change directory aliases
# ~~~~~~~~~~~~~~~~~~~~~~~~
alias src 'cd $FOAM_SRC'
alias lib 'cd $FOAM_LIB'
alias run 'cd $FOAM_RUN'
alias foam 'cd $WM_PROJECT_DIR'
alias foamsrc 'cd $FOAM_SRC/$WM_PROJECT'
alias src 'cd $FOAM_SRC'
alias foamsrc 'cd $FOAM_SRC/OpenFOAM'
alias foamfv 'cd $FOAM_SRC/finiteVolume'
alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR'
alias app 'cd $FOAM_APP'
alias util 'cd $FOAM_UTILITIES'
alias lib 'cd $FOAM_LIB'
alias run 'cd $FOAM_RUN'
alias sol 'cd $FOAM_SOLVERS'
alias tut 'cd $FOAM_TUTORIALS'
alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR'
alias util 'cd $FOAM_UTILITIES'
# more consistent naming convention
alias foamApps 'cd $FOAM_APP'
alias foamLib 'cd $FOAM_LIB'
alias foamRun 'cd $FOAM_RUN'
alias foamSol 'cd $FOAM_SOLVERS'
alias foamTut 'cd $FOAM_TUTORIALS'
alias foamUtils 'cd $FOAM_UTILITIES'
alias userApps 'cd $WM_PROJECT_USER_DIR/applications'
alias whichFoam 'echo $WM_PROJECT_DIR'
# -----------------------------------------------------------------------------
......@@ -46,16 +46,28 @@ alias wmSchedOFF='unset WM_SCHEDULER'
# Change directory aliases
# ~~~~~~~~~~~~~~~~~~~~~~~~
alias src='cd $FOAM_SRC'
alias lib='cd $FOAM_LIB'
alias run='cd $FOAM_RUN'
alias foam='cd $WM_PROJECT_DIR'
alias foamsrc='cd $FOAM_SRC/$WM_PROJECT'
alias src='cd $FOAM_SRC'
alias foamsrc='cd $FOAM_SRC/OpenFOAM'
alias foamfv='cd $FOAM_SRC/finiteVolume'
alias foam3rdParty='cd $WM_THIRD_PARTY_DIR'
alias app='cd $FOAM_APP'
alias util='cd $FOAM_UTILITIES'
alias lib='cd $FOAM_LIB'
alias run='cd $FOAM_RUN'
alias sol='cd $FOAM_SOLVERS'
alias tut='cd $FOAM_TUTORIALS'
alias foam3rdParty='cd $WM_THIRD_PARTY_DIR'
alias util='cd $FOAM_UTILITIES'
# more consistent naming convention
alias foamApps='cd $FOAM_APP'
alias foamLib='cd $FOAM_LIB'
alias foamRun='cd $FOAM_RUN'
alias foamSol='cd $FOAM_SOLVERS'
alias foamTut='cd $FOAM_TUTORIALS'
alias foamUtils='cd $FOAM_UTILITIES'
alias userApps='cd $WM_PROJECT_USER_DIR/applications'
alias whichFoam='echo $WM_PROJECT_DIR'
# -----------------------------------------------------------------------------
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment