mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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?
This commit is contained in:
@ -32,35 +32,48 @@
|
||||
# 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]
|
||||
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)
|
||||
|
||||
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
|
||||
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 app 'cd $FOAM_APP'
|
||||
alias util 'cd $FOAM_UTILITIES'
|
||||
alias sol 'cd $FOAM_SOLVERS'
|
||||
alias tut 'cd $FOAM_TUTORIALS'
|
||||
alias foam3rdParty 'cd $WM_THIRD_PARTY_DIR'
|
||||
|
||||
alias app 'cd $FOAM_APP'
|
||||
alias lib 'cd $FOAM_LIB'
|
||||
alias run 'cd $FOAM_RUN'
|
||||
alias sol 'cd $FOAM_SOLVERS'
|
||||
alias tut 'cd $FOAM_TUTORIALS'
|
||||
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 app='cd $FOAM_APP'
|
||||
alias util='cd $FOAM_UTILITIES'
|
||||
alias sol='cd $FOAM_SOLVERS'
|
||||
alias tut='cd $FOAM_TUTORIALS'
|
||||
alias foam3rdParty='cd $WM_THIRD_PARTY_DIR'
|
||||
|
||||
alias app='cd $FOAM_APP'
|
||||
alias lib='cd $FOAM_LIB'
|
||||
alias run='cd $FOAM_RUN'
|
||||
alias sol='cd $FOAM_SOLVERS'
|
||||
alias tut='cd $FOAM_TUTORIALS'
|
||||
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'
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user