|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# help_searchIndex.sh -- This function does an index search inside the
|
|
|
4c79b5 |
# info document.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# Copyright (C) 2009-2010 Alain Reguera Delgado
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is free software; you can redistribute it and/or modify
|
|
|
4c79b5 |
# it under the terms of the GNU General Public License as published by
|
|
|
4c79b5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
4c79b5 |
# (at your option) any later version.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# This program is distributed in the hope that it will be useful, but
|
|
|
4c79b5 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
4c79b5 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
4c79b5 |
# USA.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
# $Id: help_searchIndex.sh 98 2010-09-19 16:01:53Z al $
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function help_searchIndex {
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Define search pattern format
|
|
|
4c79b5 |
local PATTERN='^[[:alnum:],]+$'
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Re-define default REGEX value. If the regular expression was not
|
|
|
4c79b5 |
# provided in the third argument its value is set to '.+' which is
|
|
|
4c79b5 |
# not very useful in info --index-search contest. So, re-define
|
|
|
4c79b5 |
# this value to an empty value ('').
|
|
|
4c79b5 |
if [[ ! $REGEX =~ $PATTERN ]];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "Enter the search pattern:"` " "AsRequestLine"
|
|
|
4c79b5 |
read REGEX
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# Validate search pattern. In this (help_searchIndex) function
|
|
|
4c79b5 |
# contest, the REGEX variable is used as info search pattern, not
|
|
|
4c79b5 |
# a regular expression pattern.
|
|
|
4c79b5 |
if [[ ! "$REGEX" =~ $PATTERN ]];then
|
|
|
4c79b5 |
cli_printMessage "`gettext "The search pattern is not valid."`"
|
|
|
1f1b3c |
cli_printMessage "$(caller)" "AsToKnowMoreLine"
|
|
|
4c79b5 |
fi
|
|
|
4c79b5 |
|
|
|
4c79b5 |
# There is no need to check the entry inside documentation
|
|
|
4c79b5 |
# structure here. Just provide a word to look if there is any
|
|
|
4c79b5 |
# index matching in the info document.
|
|
|
4c79b5 |
info --index-search="$REGEX" --file=${MANUALS_FILE[4]}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
}
|