diff --git a/bin/tools/README b/bin/tools/README index 2b98a9702f3ad030ab7fb44f8075142abe3daa1b..7464f8e76356fb2d40b7f41d10c1b0d451e47a78 100644 --- a/bin/tools/README +++ b/bin/tools/README @@ -1,2 +1,2 @@ -Misc. tools, scripts, templates that are useful (eg, for building applications) -but don't need to be in the PATH. +Miscellaneous tools, scripts, templates that are useful +(eg, for building applications) but don't need to be in the PATH. diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths index b1e377dc1aa0f085b9eade0711e33b95b473f3f5..467d9d6f08f022bd7a8a2699d7cd6a81ab982c84 100755 --- a/bin/tools/foamConfigurePaths +++ b/bin/tools/foamConfigurePaths @@ -209,8 +209,7 @@ replaceCsh() done } -# Get the option's value (argument). -# Die if the argument doesn't exist or is empty +# Get the option's value (argument), or die on missing or empty argument # $1 option # $2 value getOptionValue() diff --git a/bin/tools/foamCreateManpage b/bin/tools/foamCreateManpage index 9888413e366f3fbd04cebd183f11a44b03738a2c..cf628cae7c0ebbf5d094b94274f44076a6359e69 100755 --- a/bin/tools/foamCreateManpage +++ b/bin/tools/foamCreateManpage @@ -26,11 +26,11 @@ usage() { Usage: ${0##*/} [OPTION] [appName .. [appNameN]] options: - -dir DIR Directory to process - -output DIR Write to alternative output directory + -dir=DIR Input directory to process + -output=DIR Write to alternative output directory -pdf Process as nroff man content and pass to ps2pdf -gz | -gzip Compress manpage output - -version VER Specify an alternative version + -version=VER Specify an alternative version -h | -help Print the usage Query OpenFOAM applications with -help-man for their manpage content @@ -58,6 +58,15 @@ die() exit 1 } +# Get the option's value (argument), or die on missing or empty argument +# $1 option +# $2 value +getOptionValue() +{ + [ -n "$2" ] || die "'$1' option requires an argument" + echo "$2" +} + #------------------------------------------------------------------------------- searchDirs="$FOAM_APPBIN" unset sedFilter outputDir outputType @@ -68,9 +77,12 @@ do -h | -help*) usage ;; + -dir=*) + searchDirs="${1#*=}" + [ -d "$searchDirs" ] || die "directory not found '$searchDirs'" + ;; -dir) - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - searchDirs="$2" + searchDirs=$(getOptionValue "$@") [ -d "$searchDirs" ] || die "directory not found '$searchDirs'" shift ;; @@ -80,15 +92,20 @@ do -pdf) outputType="pdf" ;; + -version=*) + version="${1#*=}" + sedFilter='s/OpenFOAM-[^\"]*/OpenFOAM-'"$version/" + ;; -version) - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - version="$2" + version=$(getOptionValue "$@") sedFilter='s/OpenFOAM-[^\"]*/OpenFOAM-'"$version/" shift ;; + -output=*) + outputDir="${1#*=}" + ;; -output) - [ "$#" -ge 2 ] || die "'$1' option requires an argument" - outputDir="$2" + outputDir=$(getOptionValue "$@") shift ;; -*) @@ -101,7 +118,7 @@ do shift done -: ${outputDir:=$defaultOutputDir} +: "${outputDir:=$defaultOutputDir}" # Verify that output is writeable if [ -e "$outputDir" ] diff --git a/bin/tools/foamPackRelease b/bin/tools/foamPackRelease index 698518266549fe173d321d0d1db70570007864c1..761137049e94789760954fb5b0f326ce29319bfb 100755 --- a/bin/tools/foamPackRelease +++ b/bin/tools/foamPackRelease @@ -28,7 +28,7 @@ # Description # Simple script generator for packing OpenFOAM sources and submodules # -# $ foamPackRelease -output some/path origin/master > create-tar +# $ foamPackRelease -output=some/path origin/master > create-tar # $ bash ./create-tar # # Or directly: @@ -46,7 +46,7 @@ cat <<USAGE Usage: ${0##*/} [OPTION] commit-ish options: - -output DIR Specify alternative output directory + -output=dir Write to alternative output directory -no-modules Exclude submodules -no-patch Ignore _patch number for the output tar-file -compress=TYPE Compress with specified type @@ -78,6 +78,7 @@ die() exit 1 } + #------------------------------------------------------------------------------- outputDir="." unset skipModules skipPatchNum @@ -94,6 +95,9 @@ do outputDir="$2" shift ;; + -output=*) + outputDir="${1#*=}" + ;; -no-modules) skipModules=true ;; @@ -291,7 +295,7 @@ case "$compress" in (tgz) echo "Using gzip compression with tgz ending" 1>&2 - echo 'gzip -c9 "$outputDir/$tarName.tar" > "$outputDir/$tarName.tgz"' + echo 'gzip -c -9 "$outputDir/$tarName.tar" > "$outputDir/$tarName.tgz"' ;; (bz | bzip | bzip2) diff --git a/bin/tools/git-find-trailingspace b/bin/tools/git-find-trailingspace index e6e74e4339b2584ad44b6b2950629956ddddd91f..9531918e3057927cc0e01a3c7abad7e5edda48d1 100755 --- a/bin/tools/git-find-trailingspace +++ b/bin/tools/git-find-trailingspace @@ -4,10 +4,10 @@ # git-find-trailingspace # # Description -# Use git grep to search for files with trailing whitespace +# Use git grep to find files with trailing whitespace # #------------------------------------------------------------------------------ -git grep -c -P '\s+$' -- $@ +git grep --count -P '\s+$' -- $@ #------------------------------------------------------------------------------