Newer
Older
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | www.openfoam.com
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2020 OpenCFD Ltd.
#------------------------------------------------------------------------------
# SPDX-License-Identifier: (GPL-3.0-or-later)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Script
# list-modules
#
# Description
# List module directories
# - each first-level directory with an Allwmake file
#
#------------------------------------------------------------------------------
cd "${0%/*}" || exit # Run from this directory
printHelp() {
cat<< HELP 1>&2
Usage: ${0##*/} [OPTION]
options:
-help Display help and exit
List module directories - each first-level directory with an Allwmake file
HELP
exit 0 # A clean exit
}
# Report error and exit
die()
{
exec 1>&2
echo
echo "Error encountered:"
while [ "$#" -ge 1 ]; do echo " $1"; shift; done
echo
echo "See '${0##*/} -help' for usage"
echo
exit 1
}
#------------------------------------------------------------------------------
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*) # Short help
printHelp
;;
*)
die "Unknown option/argument: '$1'"
;;
esac
shift
done
# Each first-level directory with an Allwmake file
for moduleName in *
do
if [ -f "$moduleName/Allwmake" ]
then
case "$moduleName" in
# Skip some directory names
(build | doc | platform*)
;;
(*)
echo "$moduleName"
;;
esac
fi
done
#------------------------------------------------------------------------------