Skip to content

Commit 29bf5a3

Browse files
committed
doc: Adding script to assist with generating man pages
Signed-off-by: Tyler Erickson <[email protected]>
1 parent 2604817 commit 29bf5a3

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

docs/generate_openSeaChest_man.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
#This script generates all the openSeaChest man pages.
4+
5+
if ! command -v help2man > /dev/null 2>&1
6+
then
7+
echo "You must install help2man to generate man pages"
8+
fi
9+
10+
if [ "$#" -lt 1 ]; then
11+
echo "You must provide a path to the openSeaChest executables"
12+
fi
13+
14+
exeDir="$1"
15+
16+
generatorDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
17+
18+
#this is a list of ALL of the tools. This is used as a "Base" to generate all of the docs for these tools
19+
openSeaChest_doc_list=("openSeaChest_Basics" "openSeaChest_Configure" "openSeaChest_Erase" "openSeaChest_Firmware" "openSeaChest_Format" "openSeaChest_GenericTests" "openSeaChest_Info" "openSeaChest_Logs" "openSeaChest_NVMe" "openSeaChest_PassthroughTest" "openSeaChest_PowerControl" "openSeaChest_Reservations" "openSeaChest_Security" "openSeaChest_SMART" "openSeaChest_ZBD")
20+
21+
for tool in "${openSeaChest_doc_list[@]}"; do
22+
echo "-------------$tool-----------"
23+
if [ -z "$tool" ]; then
24+
continue
25+
fi
26+
27+
textDoc="$generatorDir/man/man8/$tool.8"
28+
29+
if [ -f "$textDoc" ];then
30+
#remove the file if it already exists so we get a new clean one
31+
rm -f "$textDoc"
32+
fi
33+
34+
#run help2man for each utility
35+
help2man -s8 -N -n="drive utilities" -o "$textDoc" "$exeDir/$tool* --noBanner"
36+
37+
done

0 commit comments

Comments
 (0)