Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
5dde2f5b
Commit
5dde2f5b
authored
5 years ago
by
Mark OLESEN
Browse files
Options
Downloads
Patches
Plain Diff
STYLE: foamCreate{Manpage,ModuleInclude} consistency with 1912
parent
3fe4e281
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/tools/foamCreateManpage
+91
-36
91 additions, 36 deletions
bin/tools/foamCreateManpage
bin/tools/foamCreateModuleInclude
+6
-2
6 additions, 2 deletions
bin/tools/foamCreateModuleInclude
with
97 additions
and
38 deletions
bin/tools/foamCreateManpage
+
91
−
36
View file @
5dde2f5b
...
@@ -3,9 +3,11 @@
...
@@ -3,9 +3,11 @@
# ========= |
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / O peration |
# \\ / A nd |
Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd |
www.openfoam.com
# \\/ M anipulation |
# \\/ M anipulation |
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright (C) 2018-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
# <http://www.gnu.org/licenses/>.
...
@@ -26,10 +28,11 @@ usage() {
...
@@ -26,10 +28,11 @@ usage() {
Usage:
${
0
##*/
}
[OPTION] [appName .. [appNameN]]
Usage:
${
0
##*/
}
[OPTION] [appName .. [appNameN]]
options:
options:
-dir dir Directory to process
-dir=DIR Input directory to process
-gzip Compressed output
-output=DIR Write to alternative output directory
-o DIR Write to alternative output directory
-pdf Process as nroff man content and pass to ps2pdf
-version VER Specify an alternative version
-gz | -gzip Compress manpage output
-version=VER Specify an alternative version
-h | -help Print the usage
-h | -help Print the usage
Query OpenFOAM applications with -help-man for their manpage content
Query OpenFOAM applications with -help-man for their manpage content
...
@@ -37,9 +40,9 @@ and redirect to corresponding directory location.
...
@@ -37,9 +40,9 @@ and redirect to corresponding directory location.
Default input:
\$
FOAM_APPBIN only.
Default input:
\$
FOAM_APPBIN only.
Default output:
$defaultOutputDir
Default output:
$defaultOutputDir
Uses the search directory if applications are specified.
Uses the search directory if
individual
applications are specified.
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018
-2019
OpenCFD Ltd.
USAGE
USAGE
exit
1
exit
1
}
}
...
@@ -57,9 +60,18 @@ die()
...
@@ -57,9 +60,18 @@ die()
exit
1
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
"
searchDirs
=
"
$FOAM_APPBIN
"
unset
gzipFilter
sedFilter outputDir
unset
sedFilter outputDir
outputType
while
[
"$#"
-gt
0
]
while
[
"$#"
-gt
0
]
do
do
...
@@ -67,24 +79,35 @@ do
...
@@ -67,24 +79,35 @@ do
-h
|
-help
*
)
-h
|
-help
*
)
usage
usage
;;
;;
-d
|
-dir
)
-dir
=
*
)
[
"$#"
-ge
2
]
||
die
"'
$1
' option requires an argument"
searchDirs
=
"
${
1
#*=
}
"
searchDirs
=
"
$2
"
[
-d
"
$searchDirs
"
]
||
die
"directory not found '
$searchDirs
'"
;;
-dir
)
searchDirs
=
$(
getOptionValue
"
$@
"
)
[
-d
"
$searchDirs
"
]
||
die
"directory not found '
$searchDirs
'"
[
-d
"
$searchDirs
"
]
||
die
"directory not found '
$searchDirs
'"
shift
shift
;;
;;
-gz
|
-gzip
)
-gz
|
-gzip
)
gzipFilter
=
"gzip"
outputType
=
"gz"
;;
-pdf
)
outputType
=
"pdf"
;;
;;
-v
|
-version
)
-version
=
*
)
[
"$#"
-ge
2
]
||
die
"'
$1
' option requires an argument"
version
=
"
${
1
#*=
}
"
version
=
"
$2
"
sedFilter
=
's/OpenFOAM-[^\"]*/OpenFOAM-'
"
$version
/"
;;
-version
)
version
=
$(
getOptionValue
"
$@
"
)
sedFilter
=
's/OpenFOAM-[^\"]*/OpenFOAM-'
"
$version
/"
sedFilter
=
's/OpenFOAM-[^\"]*/OpenFOAM-'
"
$version
/"
shift
shift
;;
;;
-o
|
-output
)
-output
=
*
)
[
"$#"
-ge
2
]
||
die
"'
$1
' option requires an argument"
outputDir
=
"
${
1
#*=
}
"
outputDir
=
"
$2
"
;;
-output
)
outputDir
=
$(
getOptionValue
"
$@
"
)
shift
shift
;;
;;
-
*
)
-
*
)
...
@@ -97,7 +120,7 @@ do
...
@@ -97,7 +120,7 @@ do
shift
shift
done
done
:
${
outputDir
:
=
$defaultOutputDir
}
:
"
${
outputDir
:
=
$defaultOutputDir
}
"
# Verify that output is writeable
# Verify that output is writeable
if
[
-e
"
$outputDir
"
]
if
[
-e
"
$outputDir
"
]
...
@@ -105,47 +128,79 @@ then
...
@@ -105,47 +128,79 @@ then
[
-d
"
$outputDir
"
]
&&
[
-w
"
$outputDir
"
]
||
\
[
-d
"
$outputDir
"
]
&&
[
-w
"
$outputDir
"
]
||
\
die
"Cannot write to
$outputDir
"
"Not a directory, or no permission?"
die
"Cannot write to
$outputDir
"
"Not a directory, or no permission?"
else
else
mkdir
-p
"
$outputDir
"
||
\
mkdir
-p
"
$outputDir
"
2>/dev/null
||
\
die
"Cannot create directory:
$outputDir
"
die
"Cannot create directory:
$outputDir
"
fi
fi
#-------------------------------------------------------------------------------
echo
"Generating manpages from OpenFOAM applications"
1>&2
echo
1>&2
# Use a tmp file so that we confirm that the content was
# generated and looks somewhat like a manpage (has a SYNOPSIS)
tmpFile
=
"
$outputDir
/
${
0
##*/
}
-tmp
$$
"
trap
"rm -fv
$tmpFile
2>/dev/null; exit 0"
EXIT TERM INT
# Pass through content, filter for version and/or gzip
#
tmpFile
=
"
$outputDir
/
${
0
##*/
}
"
# Any special filter requirements?
trap
"rm -fv
$tmpFile
>/dev/null; exit 0"
EXIT TERM INT
# Default extension is "1" for manpage
outputExt
=
"1"
case
"
$outputType
"
in
pdf
)
outputExt
=
"pdf"
command
-v
groff
>
/dev/null
||
die
"Missing program: groff"
command
-v
ps2pdf
>
/dev/null
||
die
"Missing program: ps2pdf"
;;
gz
)
outputExt
=
"1.gz"
command
-v
gzip
>
/dev/null
||
die
"Missing program: gzip"
;;
esac
#-------------------------------------------------------------------------------
# Get nroff man content from application, store in tmp file for checking
# and output / filter
# 1 = application
process
()
process
()
{
{
local
appName
=
"
$1
"
local
appName
=
"
$1
"
local
outFile
=
"
$outputDir
/
${
appName
##*/
}
.1
"
local
outFile
=
"
$outputDir
/
${
appName
##*/
}
"
rm
-f
"
$outFile
"
*
;
rm
-f
"
$outFile
"
*
;
"
$appName
"
-help-man
2>/dev/null
>
|
$tmpFile
;
"
$appName
"
-help-man
|
sed
-e
"
${
sedFilter
}
"
2>/dev/null
>
|
"
$tmpFile
"
# Check that it looks ok
if
grep
-F
-q
"SYNOPSIS"
"
$tmpFile
"
2>/dev/null
if
grep
-F
-q
"SYNOPSIS"
"
$tmpFile
"
2>/dev/null
then
then
cat
"
$tmpFile
"
|
\
case
"
$outputType
"
in
sed
-e
"
${
sedFilter
}
"
|
"
${
gzipFilter
:-
cat
}
"
\
pdf
)
>
|
"
$outFile
${
gzipFilter
:+.gz
}
"
groff
-man
"
$tmpFile
"
| ps2pdf -
"
$outFile
.
$outputExt
"
;;
echo
"
$outFile
${
gzipFilter
:+.gz
}
"
1>&2
gz
)
gzip
-c
"
$tmpFile
"
>
|
"
$outFile
.
$outputExt
"
;;
*
)
\c
p
-f
"
$tmpFile
"
"
$outFile
.
$outputExt
"
;;
esac
echo
"
$outFile
.
$outputExt
"
1>&2
else
else
echo
"Problem with
$appName
"
1>&2
echo
"Problem with
$
{
appName
##*/
}
"
1>&2
fi
fi
}
}
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Default to standard search directories
# Default to standard search directories
[
"$#"
-gt
0
]
||
set
--
${
searchDirs
}
[
"$#"
-gt
0
]
||
set
--
${
searchDirs
}
echo
"Generating manpages from OpenFOAM applications"
1>&2
echo
1>&2
for
item
for
item
do
do
if
[
-d
"
$item
"
]
if
[
-d
"
$item
"
]
...
@@ -157,7 +212,7 @@ do
...
@@ -157,7 +212,7 @@ do
do
do
process
$appName
process
$appName
done
done
elif
command
-v
"
$item
"
>
/dev/null
2>&1
elif
command
-v
"
$item
"
>
/dev/null
then
then
process
$item
process
$item
else
else
...
...
This diff is collapsed.
Click to expand it.
bin/tools/foamCreateModuleInclude
+
6
−
2
View file @
5dde2f5b
...
@@ -3,8 +3,11 @@
...
@@ -3,8 +3,11 @@
# ========= |
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017-2019 OpenCFD Ltd.
# \\ / A nd | www.openfoam.com
# \\/ M anipulation | Copyright (C) 2016-2017 CINECA
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2016-2017 CINECA
# Copyright (C) 2017-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# License
# License
# This file is part of OpenFOAM.
# This file is part of OpenFOAM.
...
@@ -263,6 +266,7 @@ unalias wmDP 2>/dev/null
...
@@ -263,6 +266,7 @@ unalias wmDP 2>/dev/null
unalias
wmInt32 2>/dev/null
unalias
wmInt32 2>/dev/null
unalias
wmInt64 2>/dev/null
unalias
wmInt64 2>/dev/null
unalias
wmSP 2>/dev/null
unalias
wmSP 2>/dev/null
unalias
wmSPDP 2>/dev/null
unalias
wmSchedOff 2>/dev/null
unalias
wmSchedOff 2>/dev/null
unalias
wmSchedOn 2>/dev/null
unalias
wmSchedOn 2>/dev/null
unalias
wmSet 2>/dev/null
unalias
wmSet 2>/dev/null
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment