File: genallman.sh

package info (click to toggle)
rows 0.2.1-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 784 kB
  • ctags: 547
  • sloc: python: 4,621; sh: 59; makefile: 33
file content (30 lines) | stat: -rwxr-xr-x 1,063 bytes parent folder | download | duplicates (6)
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
#!/bin/bash

# Generate several manpages at the same time.
# C 2014 Joao Eriberto Mota Filho <eriberto@debian.org>
# C 2015 Paulo Roberto Alves de Oliveira (aka kretcheu) <kretcheu@gmail.com>
#
# You can use this code in the same terms of the BSD-3-clause license or,
# optionally, in the same terms of the license used in debian/ directory
# in this Debian package. Please, to the last option, refer the package
# name when using.
#
# This script uses txt2man. You need program_name.txt.
#
# The first line of files must be use this structure:
#
# .TH <program_name> "<manpage_level>"  "<date>" "<program_name_upper_case> <program_version>" "<program_description>"
#
# Example:
#
# .TH mac-robber "1"  "May 2013" "MAC-ROBBER 1.02" "collects data about allocated files in mounted filesystems"
MANDIR="debian/manpage"
cd ${MANDIR}

for NAME in $(find . -maxdepth 1 -name "*txt" -printf "%f\n")
do
    LEVEL=$(head -n1 $NAME | cut -d'"' -f2 )
    MAN=$(echo ${NAME%%.txt})
    head -n1 $NAME > $MAN.$LEVEL
    txt2man $NAME | grep -a -v '^.TH ' >> $MAN.$LEVEL
done