e82789
Add help_getEntries.sh.
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# help_getEntries.sh -- This function interpretes non-option
|
4
|
+
# arguments passed to `help' functionality through the command-line
|
5
|
+
# and redefines array variables related to documentation entries.
|
6
|
+
#
|
7
|
+
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
8
|
+
#
|
9
|
+
# This program is free software; you can redistribute it and/or modify
|
10
|
+
# it under the terms of the GNU General Public License as published by
|
11
|
+
# the Free Software Foundation; either version 2 of the License, or (at
|
12
|
+
# your option) any later version.
|
13
|
+
#
|
14
|
+
# This program is distributed in the hope that it will be useful, but
|
15
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
# General Public License for more details.
|
18
|
+
#
|
19
|
+
# You should have received a copy of the GNU General Public License
|
20
|
+
# along with this program; if not, write to the Free Software
|
21
|
+
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
22
|
+
#
|
23
|
+
# ----------------------------------------------------------------------
|
24
|
+
# $Id$
|
25
|
+
# ----------------------------------------------------------------------
|
26
|
+
|
27
|
+
function help_getEntries {
|
28
|
+
|
29
|
+
local DOCENTRY=''
|
30
|
+
|
31
|
+
# Redefine positional parameters using ARGUMENTS. At this point,
|
32
|
+
# option arguments have been removed from ARGUMENTS variable and
|
33
|
+
# only non-option arguments remain in it.
|
34
|
+
eval set -- "$ARGUMENTS"
|
35
|
+
|
36
|
+
# Build manual array to store information required to process
|
37
|
+
# documentation entries (e.g., manual name, chapter name and
|
38
|
+
# section name.) At this point all option arguments have been
|
39
|
+
# removed from positional paramters so we can use the remaining
|
40
|
+
# non-option arguments as reference to retrive documentation
|
41
|
+
# entries. Documentation entries passed as non-opiton arguments
|
42
|
+
# must have the `MANUAL:CHAPTER:SECTION' format in order to be
|
43
|
+
# processed correctly here.
|
44
|
+
for DOCENTRY in $@;do
|
45
|
+
|
46
|
+
# Manual self name.
|
47
|
+
MANUAL_SLFN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \
|
48
|
+
$(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $1 }') -f \
|
49
|
+
| tr '[:upper:]' '[:lower:]')
|
50
|
+
|
51
|
+
# Manual directory name.
|
52
|
+
MANUAL_DIRN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \
|
53
|
+
$(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $1 }') -f \
|
54
|
+
| tr '[:lower:]' '[:upper:]')
|
55
|
+
|
56
|
+
# Manual chapter name.
|
57
|
+
MANUAL_CHAN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \
|
58
|
+
$(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $2 }') -d )
|
59
|
+
|
60
|
+
# Manual section name.
|
61
|
+
MANUAL_SECN[${MANUAL_DOCENTRY_COUNT}]=$(cli_getRepoName \
|
62
|
+
$(echo "$DOCENTRY" | gawk 'BEGIN{ FS=":" } { print $3 }') -f )
|
63
|
+
|
64
|
+
# Increment counting of non-option arguments.
|
65
|
+
MANUAL_DOCENTRY_COUNT=$(($MANUAL_DOCENTRY_COUNT + 1))
|
66
|
+
|
67
|
+
done
|
68
|
+
|
69
|
+
}
|