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)
|
# Prints its argument (which should be a ':' separated path)
|
||||||
# without all
|
# without all
|
||||||
# - duplicate elements
|
# - duplicate elements
|
||||||
# - (if '-strip') non-accessible directories
|
|
||||||
# - elements whose start matches a wildcard
|
# - elements whose start matches a wildcard
|
||||||
|
# - inaccessible directories (with the -strip option)
|
||||||
#
|
#
|
||||||
# Note:
|
# Note:
|
||||||
# - this routine will fail when directories have embedded spaces
|
# - this routine will fail when directories have embedded spaces
|
||||||
# - false matches possible if a wildcard contains '.' (sed regex)
|
# - false matches possible if a wildcard contains '.' (sed regex)
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
if [ "$#" -lt 1 -o "$1" = "-h" -o "$1" = "-help" ]
|
usage() {
|
||||||
then
|
|
||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [-strip] path [wildcard] .. [wildcard]
|
usage: ${0##*/} [-strip] path [wildcard] .. [wildcard]
|
||||||
|
|
||||||
Prints its argument (which should be a ':' separated list) cleansed from
|
Prints its argument (which should be a ':' separated list) cleansed from
|
||||||
- duplicate elements
|
- duplicate elements
|
||||||
- elements whose start matches one of the wildcard(s)
|
- elements whose start matches one of the wildcard(s)
|
||||||
- (if '-strip') non-accessible directories
|
- inaccessible directories (with the -strip option)
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
|
||||||
strip=''
|
unset strip
|
||||||
if [ "$1" = "-strip" ]
|
# parse options
|
||||||
then
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-strip)
|
||||||
strip=true
|
strip=true
|
||||||
shift
|
shift
|
||||||
fi
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
[ "$#" -ge 1 ] || usage
|
||||||
|
|
||||||
dirList="$1"
|
dirList="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
@ -79,7 +92,7 @@ do
|
|||||||
wildcard=$1
|
wildcard=$1
|
||||||
shift
|
shift
|
||||||
##DEBUG echo "remove>$wildcard<" 1>&2
|
##DEBUG echo "remove>$wildcard<" 1>&2
|
||||||
dirList=`echo "$dirList" | sed -e "s@${wildcard}[^:]*:@@g"`
|
dirList=$(echo "$dirList" | sed -e "s@${wildcard}[^:]*:@@g")
|
||||||
done
|
done
|
||||||
|
|
||||||
# split on ':' (and on space as well to avoid any surprises)
|
# split on ':' (and on space as well to avoid any surprises)
|
||||||
@ -97,13 +110,13 @@ do
|
|||||||
if [ -e "$dir" ]
|
if [ -e "$dir" ]
|
||||||
then
|
then
|
||||||
#- no duplicate dirs
|
#- no duplicate dirs
|
||||||
duplicate=`echo " $dirList " | sed -ne "s@ $dir @DUP@p"`
|
duplicate=$(echo " $dirList " | sed -ne "s@ $dir @DUP@p")
|
||||||
|
|
||||||
if [ ! "$duplicate" ]
|
if [ ! "$duplicate" ]
|
||||||
then
|
then
|
||||||
dirList="$dirList $dir"
|
dirList="$dirList $dir"
|
||||||
fi
|
fi
|
||||||
elif [ "$strip" != "true" ]
|
elif [ "$strip" != true ]
|
||||||
then
|
then
|
||||||
# Print non-existing directories if not in 'strip' mode.
|
# Print non-existing directories if not in 'strip' mode.
|
||||||
dirList="$dirList $dir"
|
dirList="$dirList $dir"
|
||||||
|
|||||||
@ -46,16 +46,28 @@ alias wmSchedOFF 'unsetenv WM_SCHEDULER'
|
|||||||
|
|
||||||
# Change directory aliases
|
# 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 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 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 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
|
# 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 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 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 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