blob: 8a35cdf28d00e9d838a5ac0213a0b9772f50f451 (
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
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/bash
# after the addition of new options, two regions of the documentation in
# isodoc.dtx need to be updated:
# 1. the body of the definition of \showkeys
# listkeys will print that body with the argument |show|
# 2. The body of the tabular (in the section `Commands'), which shows
# the options having a corresponding command.
# listkeys will print that body with the argument `defs'
#
# An easy way to replace the data in isodoc.dtx is, using the vim editor:
# 1. select the lines (the contents of \def\showkeys, say) with V and then
# 2. type :!listkeys show
usage() { echo "Usage: listkeys defs|show"; exit; }
[[ -z $1 ]] && usage
type=$1
[[ $type =~ ^(defs|show)$ ]] || usage
minipage='^(acceptdesc|copyto|enclosures|logoaddres|signature|returnaddress)$'
# find keys which have a corresponding command:
a=($(
while read -r x; do
[[ $x =~ define@key ]] || continue
# \define@key{isodoc}{closing} {\def\closing{#1}}
re='\\define@key\{isodoc\}\{([[:alpha:]]+)\}.*\\def\\\1\{'
# ----word---- ^^-same word
[[ $x =~ $re ]] || continue
echo ${BASH_REMATCH[1]}
done<isodoc.dtx |sort
))
if [[ $type == show ]]; then
for i in ${a[@]}; do
if [[ $i =~ $minipage ]]; then
printf "%20s & \\%s\\NN\n" $i "@isodocmp{\\$i}"
else
printf "%20s & \\%s\\NN\n" $i $i
fi
done
else
which cols >/dev/null || {
echo "listkeys needs the cols script; you can find that here:"
echo "https://bitbucket.org/wybodekker/cols/src/7af1a60161bf2ce45a3842582475de7eb621a1cf/cols?at=default"
echo "or here:"
echo "http://www.dekkerdocumenten.nl/unix/cols"
exit 1
}
for i in ${a[@]}; do echo $i; done |
cols -5 --squeeze --sep=' & ' --suf='\NN' --pre='% '
fi
|