File: binaries-extract-one-line-man-desc.sh

package info (click to toggle)
openms 2.4.0-real-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 646,136 kB
  • sloc: cpp: 392,260; xml: 215,373; python: 10,976; ansic: 3,325; php: 2,482; sh: 901; ruby: 399; makefile: 141; perl: 85
file content (40 lines) | stat: -rwxr-xr-x 1,112 bytes parent folder | download | duplicates (2)
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
#!/bin/sh -e

binDir="build/bin"

cd ${binDir}

manPage="../../topp.1"
debLinkFile="../../topp.links"

# Start fresh
rm -f ${debLinkFile}

# List all files in here, but not the Tutorial* binaries.
# Add a dot to the end of each line, where missing.

# First cat the top part of the man page to a temp file

cat ../../topp.1-top-skel > ${manPage}

# Now make the one-liners appear after the top.  Note that each time a
# new binary is dealt with, we create a corresponding link in
# ${debLinkFile}, as each binary must have a corresponding man page.

for file in $(find * -type f -executable -print | grep -v ^Tutorial)
do
    # The man page itself
    oneLiner=$(./$file --help 2>&1 | grep "${file} --" | sed "s|\([^\.]$\)|\1.|g")
    formattedOneLiner=$(echo "${oneLiner}" | sed 's|\(^[[:alnum:]]\+\)|\\\\fB\1\\\\fR|g')
    echo ${formattedOneLiner} >> ${manPage}
    echo "" >> ${manPage}

    # The symbolic link
    echo "usr/share/man/man1/topp.1 usr/share/man/man1/${file}.1" >> ${debLinkFile}
done

# Finally make the bottom of the page.

cat ../../topp.1-bottom-skel >> ${manPage}

cd - > /dev/null 2>&1