blob: bbd9b0f8dabe7b175eab38dfc461810a4a646100 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
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
|
#!/bin/bash
schemasurl='http://schemas.dmtf.org/wbem/cim-html/2.31.0/'
usage()
{
printf "$0 usage:\n"
printf "$0 file\n"
printf "$0 will read file and show which classes are defined in mof file "
printf "and print in pretty format usable easy in wiki\n"
}
die()
{
printf "%s\n" "$@"
exit 1
} >&2
(( $# > 0 )) || die "Invalid number of parameters"
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 0
fi
moffile="$1"
[[ -r "$moffile" ]] || die "$moffile is not readable"
export LC_ALL=C
printf "||= Defined class name =||= Inherited from =||\n"
while IFS= read line; do
if [[ $line =~ ^class[[:blank:]]*([[:alnum:]_]*)":"[[:blank:]]*([[:alnum:]_]*) ]]; then
newclass=${BASH_REMATCH[1]}
derived=${BASH_REMATCH[2]}
printf "|| [wiki:%s %s] || [$schemasurl%s.html %s] ||\n" "$newclass" "$newclass" "$derived" "$derived"
fi
done < "$moffile"
|