Blame Manuals/en/Html/Repository/repository_41.html

4c79b5
4c79b5
<html>
6414c4
09d4f2
6414c4
Copyright C 2009, 2010, 2011  Alain Reguera Delgado
4c79b5
4c79b5
Permission is granted to copy, distribute and/or modify this document
4c79b5
under the terms of the GNU Free Documentation License, Version 1.2 or
4c79b5
any later version published by the Free Software Foundation; with no
4c79b5
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
4c79b5
copy of the license is included in the section entitled GNU Free
4c79b5
Documentation License.  
4c79b5
-->
6414c4
4c79b5
4c79b5
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
4c79b5
            Karl Berry  <karl@freefriends.org>
4c79b5
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
4c79b5
            and many others.
4c79b5
Maintained by: Many creative people <dev@texi2html.cvshome.org>
4c79b5
Send bugs and suggestions to <users@texi2html.cvshome.org>
4c79b5
4c79b5
-->
4c79b5
<head>
280c77
<title>The CentOS Artwork Repository: 3.38 trunk/Scripts/Bash/Functions</title>
4c79b5
280c77
<meta name="description" content="The CentOS Artwork Repository: 3.38 trunk/Scripts/Bash/Functions">
280c77
<meta name="keywords" content="The CentOS Artwork Repository: 3.38 trunk/Scripts/Bash/Functions">
4c79b5
<meta name="resource-type" content="document">
4c79b5
<meta name="distribution" content="global">
4c79b5
<meta name="Generator" content="texi2html 1.76">
4c79b5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4c79b5
<style type="text/css">
4c79b5
1e9202
@import "/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/common.css";
4c79b5
4c79b5
a.summary-letter {text-decoration: none}
4c79b5
pre.display {font-family: serif}
4c79b5
pre.format {font-family: serif}
4c79b5
pre.menu-comment {font-family: serif}
4c79b5
pre.menu-preformatted {font-family: serif}
4c79b5
pre.smalldisplay {font-family: serif; font-size: smaller}
4c79b5
pre.smallexample {font-size: smaller}
4c79b5
pre.smallformat {font-family: serif; font-size: smaller}
4c79b5
pre.smalllisp {font-size: smaller}
4c79b5
span.sansserif {font-family:sans-serif; font-weight:normal;}
4c79b5
ul.toc {list-style: none}
4c79b5
-->
4c79b5
</style>
4c79b5
4c79b5
4c79b5
</head>
4c79b5
4c79b5
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
4c79b5
4c79b5
280c77
[ < ]
280c77
[ > ]
4c79b5
   
4c79b5
[ << ]
4c79b5
[ Up ]
280c77
[ >> ]
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
[Top]
4c79b5
[Contents]
280c77
[Index]
4c79b5
[ ? ]
4c79b5
280c77
280c77
280c77

3.38 trunk/Scripts/Bash/Functions

280c77
280c77
280c77
280c77

3.38.1 Goals

280c77
280c77

The <tt>`trunk/Scripts/Bash/Functions'</tt> directory exists to organize

280c77
<tt>`centos-art.sh'</tt> specific functionalities.
280c77

280c77
280c77
280c77

3.38.2 Description

280c77
280c77

The specific functions of <tt>`centos-art.sh'</tt> script are designed

280c77
with "Software Toolbox" philosophy (see (coreutils.info)Toolbox introduction) in mind: each program "should do one
280c77
thing well".  Inside <tt>`centos-art.sh'</tt> script, each specific
280c77
functionality is considered a program that should do one thing well.
280c77
Of course, if you find that they still don't do it, feel free to
280c77
improve them in order for them to do so.
280c77

280c77

The specific functions of <tt>`centos-art.sh'</tt> script are organized

280c77
inside specific directories under <tt>`trunk/Scripts/Bash/Functions'</tt>
280c77
location. Each specific function directory should be named as the
280c77
function it represents, with the first letter in uppercase. For
280c77
example, if the function name is render, the specific function
280c77
directory for it would be <samp>`trunk/Scripts/Bash/Functions/Render'</samp>.
280c77

280c77

To better understand how specific functions of <tt>`centos-art.sh'</tt>

280c77
script are designed, lets create one function which only goal is to
280c77
output different kind of greetings to your screen.
280c77

280c77

When we create specific functions for <tt>`centos-art.sh'</tt> script it

280c77
is crucial to know what these functions will do exactly and if there
280c77
is any function that already does what we intend to do. If there is no
280c77
one, it is good time to create them then. Otherwise, if
280c77
functionalities already available don't do what you exactly expect,
280c77
contact their authors and work together to improve them.
280c77

280c77
Info

Tip

Join CentOS developers mailing list

280c77
centos-art@centos.org to share your ideas.
280c77

280c77
280c77

It is also worth to know what global functions and variables do we

280c77
have available inside <tt>`centos-art.sh'</tt> script, so advantage can be
280c77
taken from them. Global variables are defined inside global function
280c77
scripts. Global functions scripts are stored immediatly under
280c77
<tt>`trunk/Scripts/Bash/Functions'</tt> directory, in files begining with
280c77
<samp>`cli'</samp> prefix.
280c77

280c77

OK, let's begin with our functionality example.

280c77

280c77

What function name do we use? Well, lets use greet. Note that

280c77
<samp>`hello'</samp> word is not a verb; but an expression, a kind of
280c77
greeting, an interjection specifically. In contrast, <samp>`greet'</samp> is a
280c77
verb and describes what we do when we say <samp>`Hello!'</samp>, <samp>`Hi!'</samp>,
280c77
and similar expressions.
280c77

280c77

So far, we've gathered the following function information:

280c77

280c77
Name: greet
280c77
Path: trunk/Scripts/Bash/Functions/Greet
280c77
File: trunk/Scripts/Bash/Functions/Greet/greet.sh
280c77
280c77

The <tt>`greet.sh'</tt> function script is the first file

280c77
<tt>`centos-art.sh'</tt> script loads when the <samp>`greet'</samp> functionality
280c77
is called using commands like <samp>`centos-art greet --hello='World''</samp>.
280c77
The <tt>`greet.sh'</tt> function script contains the greet function
280c77
definition. 
280c77

280c77

Inside <tt>`centos-art.sh'</tt> script, as convenction, each function

280c77
script has one top commentary, followed by one blank line, and then
280c77
one function defintion below it only.
280c77

280c77

Inside <tt>`centos-art.sh'</tt> script functions, top commentaries have

280c77
the following components: the functionality description, one-line for
280c77
copyright note with your personal information,  the license under
280c77
which the function source code is released --the <tt>`centos-art.sh'</tt>
280c77
script is released as GPL, so do all its functions--, subversion's
280c77
$Id$ keyword which is later expanded by svn propset
280c77
command.
280c77

280c77

In our greet function example, top commentary for

280c77
<tt>`greet.sh'</tt> function script would look like the following:
280c77

280c77
#!/bin/bash
280c77
#
280c77
# greet.sh -- This function outputs different kind of greetings to
280c77
# your screen. Use this function to understand how centos-art.sh
280c77
# script specific functionalities work.
280c77
#
280c77
# Copyright (C) YEAR YOURFULLNAME
280c77
#
280c77
# This program is free software; you can redistribute it and/or modify
280c77
# it under the terms of the GNU General Public License as published by
280c77
# the Free Software Foundation; either version 2 of the License, or
280c77
# (at your option) any later version.
280c77
# 
280c77
# This program is distributed in the hope that it will be useful, but
280c77
# WITHOUT ANY WARRANTY; without even the implied warranty of
280c77
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
280c77
# General Public License for more details.
280c77
#
280c77
# You should have received a copy of the GNU General Public License
280c77
# along with this program; if not, write to the Free Software
280c77
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
280c77
# USA.
280c77
# 
280c77
# ----------------------------------------------------------------------
280c77
# $Id$
280c77
# ----------------------------------------------------------------------
280c77
280c77

After top commentary, separated by one blank line, the greet

280c77
function definition would look like the following:
280c77

280c77
function greet {
280c77
280c77
    # Define global variables.
280c77
280c77
    # Define command-line interface.
280c77
    greet_getActions
280c77
280c77
}
280c77
280c77

The first definition inside greet function, are global

280c77
variables that will be available along greet function execution
280c77
environment. This time we didn't use global variable definitions for
280c77
greet function execution environment, so we left that section
280c77
empty.
280c77

280c77

Later, we call greet_getActions function to define the

280c77
command-line interface of greet functionality. The command-line
280c77
interface of greet functionality defines what and how actions
280c77
are performed, based on arguments combination passed to
280c77
<tt>`centos-art.sh'</tt> script.
280c77

280c77
function greet_getActions {
280c77
280c77
    case "$ACTIONNAM" in
280c77
280c77
        --hello )
280c77
            greet_doHello
280c77
            ;;
280c77
280c77
        --bye )
280c77
            greet_doBye
280c77
            ;;
280c77
280c77
        * )
280c77
            cli_printMessage "`gettext "The option provided is not valid."`"
280c77
            cli_printMessage "$(caller)" 'AsToKnowMoreLine'
280c77
280c77
    esac
280c77
280c77
}
280c77
280c77

The ACTIONNAM global variable is defined in <tt>`cli.sh'</tt>

280c77
function script and contains the value passed before the equal sign
280c77
(i.e., <samp>`='</samp>) in the second command-line argument of
280c77
<tt>`centos-art.sh'</tt> script. For example, if the second command-line
280c77
argument is <samp>`--hello='World''</samp>, the value of ACTIONNAM
280c77
variable would be <samp>`--hello'</samp>.  Using this configuration let us
280c77
deside which action to perform based on the action name passed to
280c77
<tt>`centos-art.sh'</tt> script as second argument. 
280c77

280c77

The greet function definition makes available two valid

280c77
greetings through <samp>`--hello'</samp> and <samp>`--bye'</samp> options.  If no
280c77
one of them is provided as second command-line argument, the <samp>`*'</samp>
280c77
case is evaluated instead. 
280c77

280c77

The <samp>`*'</samp> case and its two lines further on should always be

280c77
present in <tt>`_getActions.sh'</tt> function scripts, no matter what
280c77
specific functionality you are creating. This convenction helps the
280c77
user to find out documentation about current functionality in use,
280c77
when no valid action is provided.
280c77

280c77

The greet_doHello and greet_doBye function definitions

280c77
are the core of greet specific functionality.  In such function
280c77
definitions we set what our greet function really does: to
280c77
output different kinds of greetings.
280c77

280c77
function greet_doHello {
280c77
280c77
    cli_printMessage "`gettext "Hello"` $ACTIONVAL"
280c77
280c77
}
280c77
280c77

The greet_doHello function definition is stored in

280c77
<tt>`greet_doHello.sh'</tt> function script. 
280c77

280c77
function greet_doBye {
280c77
280c77
    cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
280c77
280c77
}
280c77
280c77

The greet_doBye function definition is stored in the

280c77
<tt>`greet_doBye.sh'</tt> function script. 
280c77

280c77

Both <tt>`greet_doHello.sh'</tt> and <tt>`greet_doBye.sh'</tt> function

280c77
scripts are stored inside greet's function directory path (i.e.
280c77
<tt>`trunk/Scripts/Bash/Functions/Greet'</tt>).
280c77

280c77

The ACTIONVAL global variable is defined in <tt>`cli.sh'</tt>

280c77
function script and contains the value passed after the equal sign
280c77
(i.e., <samp>`='</samp>) in the second command-line argument of
280c77
<tt>`centos-art.sh'</tt> script. For example, if the second command-line
280c77
argument is <samp>`--hello='World''</samp>, the value of ACTIONVAL
280c77
variable would be <samp>`World'</samp> without quotes.
280c77

280c77

Let's see how greet specific functionality files are organzied

280c77
under greet's function directory. To see file organization we
280c77
use the tree command:
280c77

280c77
trunk/Scripts/Bash/Functions/Greet
280c77
|-- greet_doBye.sh
280c77
|-- greet_doHello.sh
280c77
|-- greet_getActions.sh
280c77
`-- greet.sh
280c77
280c77

To try the greet specific functionality we've just created,

280c77
pass the function name (i.e., <samp>`greet'</samp>) as first argument to
280c77
<tt>`centos-art.sh'</tt> script, and any of the valid options as second
280c77
argument. Some examples are illustrated below:
280c77

280c77
[centos@projects ~]$ centos-art greet --hello='World'
280c77
Hello World
280c77
[centos@projects ~]$ centos-art greet --bye='World'
280c77
Goodbye World
280c77
[centos@projects ~]$ 
280c77
280c77

The word <samp>`World'</samp> in the examples above can be anything. In fact,

280c77
change it to have a little fun.
280c77

280c77

Now that we have a specific function that works as we expect, it is

280c77
time to document it.  To document greet specific functionality,
280c77
we use its directory path and the manual functionality
280c77
(see section trunk/Scripts/Bash/Functions/Manual) of <tt>`centos-art.sh'</tt>
280c77
script, just as the following command illustrates: 
280c77

280c77
centos-art manual --edit=trunk/Scripts/Bash/Functions/Greet
280c77
280c77

To have a well documented function helps user to understand how your

280c77
function really works, and how it should be used.  When no valid
280c77
action is passed to a function, the <tt>`centos-art.sh'</tt> script uses
280c77
the function documentation entry as vehicle to communicate which the
280c77
valid functions are. When no documentation entry exists for a
280c77
function, the <tt>`centos-art.sh'</tt> script informs that no
280c77
documentation entry exists for such function and requests user to
280c77
create it right at that time.
280c77

280c77

Now that we have documented our function, it is time to translate its

280c77
output messages to different languages. To translate specific
280c77
functionality output messages to different languages we use the
280c77
locale functionality (see section trunk/Scripts/Bash/Functions/Locale) of <tt>`centos-art.sh'</tt> script, just as the following command
280c77
illustrates:
280c77

280c77
centos-art locale --edit
280c77
280c77
Warning

Warning

To translate output messages in different languages,

280c77
your system locale information --as in LANG environment
280c77
variable-- must be set to that locale you want to produce translated
280c77
messages for. For example, if you want to produce translated messages
280c77
for Spanish language, your system locale information must be set to
280c77
<samp>`es_ES.UTF-8'</samp>, or similar, first.
280c77

280c77
280c77

Well, it seems that our example is rather complete by now.

280c77

280c77

In greet function example we've described so far, we only use

280c77
cli_printMessage global function in action specific function
280c77
definitions in order to print messages, but more interesting things
280c77
can be achieved inside action specific function definitions.  For
280c77
example, if you pass a directory path as action value in second
280c77
argument, you could retrive a list of files from therein, and process
280c77
them. If the list of files turns too long or you just want to control
280c77
which files to process, you could add the third argument in the form
280c77
<samp>`--filter='regex''</samp> and reduce the amount of files to process
280c77
using a regular expression pattern.
280c77

280c77

The greet function described in this section may serve you as

280c77
an introduction to understand how specific functionalities work inside
280c77
<tt>`centos-art.sh'</tt> script. With some of luck this introduction will
280c77
also serve you as motivation to create your own <tt>`centos-art.sh'</tt>
280c77
script specific functionalities.
280c77

280c77

By the way, the greet functionality doesn't exist inside

280c77
<tt>`centos-art.sh'</tt> script yet. Would you like to create it?
280c77

280c77
01b527
280c77

3.38.3 Usage

54264c
54264c
01b527
280c77

3.38.3.1 Global variables

280c77
280c77

The following global variables of <tt>`centos-art.sh'</tt> script, are

280c77
available for you to use inside specific functions:
280c77

280c77
280c77
<u>Variable:</u> TEXTDOMAIN
280c77
280c77
280c77

Default domain used to retrieve translated messages. This value is set

280c77
in <tt>`initFunctions.sh'</tt> and shouldn't be changed.
280c77

280c77
280c77
280c77
<u>Variable:</u> TEXTDOMAINDIR
280c77
280c77
280c77

Default directory used to retrieve translated messages. This value is

280c77
set in <tt>`initFunctions.sh'</tt> and shouldn't be changed.
280c77

280c77
280c77
280c77
<u>Variable:</u> FUNCNAM
280c77
280c77
280c77

Define function name.

280c77

280c77

Function names associate sets of actions. There is one set of actions

280c77
for each unique function name inside <tt>`centos-art.sh'</tt> script.
280c77

280c77

Dunction names are passed as first argument in <tt>`centos-art.sh'</tt>

280c77
command-line interface. For example, in the command <samp>`centos-art
280c77
render --entry=path/to/dir --filter=regex'</samp>, the ACTION passed to
280c77
<tt>`centos-art.sh'</tt> script is <samp>`render'</samp>.
280c77

280c77

When first argument is not provided, the <tt>`centos-art.sh'</tt> script

280c77
immediatly ends its execution.
280c77

280c77
280c77
280c77
<u>Variable:</u> FUNCDIR
280c77
280c77
280c77
280c77
280c77
280c77
<u>Variable:</u> FUNCDIRNAME
280c77
280c77
280c77
280c77
280c77
280c77
<u>Variable:</u> FUNCSCRIPT
280c77
280c77
280c77
6414c4
280c77
280c77
<u>Variable:</u> FUNCCONFIG
280c77
280c77
280c77
280c77
280c77
280c77
<u>Variable:</u> ACTIONNAM
280c77
280c77
280c77

Define action name.

280c77

280c77

Each action name identifies an specific action to perform, inside an

280c77
specific function.
280c77

280c77

Action name names aare passed as second argument in

280c77
<tt>`centos-art.sh'</tt> command-line interface. For example, in the
280c77
command <samp>`centos-art render --entry=path/to/dir --filter=regex'</samp>,
280c77
the ACTIONNAM passed to <tt>`centos-art.sh'</tt> script is
280c77
<samp>`--entry'</samp>.
280c77

280c77

When second argument is not provided, the <tt>`centos-art.sh'</tt> script

280c77
immediatly ends its execution.
280c77

280c77
280c77
280c77
<u>Variable:</u> ACTIONVAL
280c77
280c77
280c77

Define action value.

280c77

280c77

Action values are associated to just one action name. Action values

280c77
contain the working copy entry over which its associated action will be
280c77
performed in.  Working copy entries can be files or directories inside
280c77
the working copy.
280c77

280c77
280c77
280c77
<u>Variable:</u> REGEX
280c77
280c77
280c77

Define regular expression used as pattern to build the list of files

280c77
to process.
280c77

280c77

By default, REGEX variable is set to .+ to match all

280c77
files.
280c77

280c77

Functions that need to build a list of files to process use the option

280c77
<samp>`--filter'</samp> to redefine REGEX variable default value, and
280c77
so, control the amount of files to process.
280c77

280c77
280c77
280c77
<u>Variable:</u> ARGUMENTS
280c77
280c77
280c77

Define optional arguments.

280c77

280c77

Optional arguments, inside <tt>`centos-art.sh'</tt> script, are considered

280c77
as all command-line arguments passed to <tt>`centos-art.sh'</tt> script,
280c77
from third argument position on. For example, in the command
280c77
<samp>`centos-art render --entry=path/to/dir --filter=regex'</samp> , the
280c77
optional arguments are from <samp>`--filter=regex'</samp> argument on.
280c77

280c77

Optional arguments are parsed using getopt command through

280c77
the following base construction: 
280c77

280c77
# Define short options we want to support.
280c77
local ARGSS=""
280c77
280c77
# Define long options we want to support.
280c77
local ARGSL="filter:,to:"
280c77
280c77
# Parse arguments using getopt(1) command parser.
280c77
cli_doParseArguments
280c77
280c77
# Reset positional parameters using output from (getopt) argument
280c77
# parser.
280c77
eval set -- "$ARGUMENTS"
280c77
280c77
# Define action to take for each option passed.
280c77
while true; do
280c77
    case "$1" in
280c77
        --filter )
280c77
            REGEX="$2" 
280c77
            shift 2
280c77
            ;;
280c77
        --to )
280c77
            TARGET="$2" 
280c77
            shift 2
280c77
            ;;
280c77
        * )
280c77
            break
280c77
    esac
280c77
done
280c77
280c77

Optional arguments provide support to command options inside

280c77
<tt>`centos-art.sh'</tt> script. For instance, consider the Subversion
280c77
(svn) command, where there are many options (e.g.,
280c77
<samp>`copy'</samp>, <samp>`delete'</samp>, <samp>`move'</samp>, etc), and inside each
280c77
option there are several modifiers (e.g., <samp>`--revision'</samp>,
280c77
<samp>`--message'</samp>, <samp>`--username'</samp>, etc.) that can be combined one
280c77
another in their short or long variants. 
280c77

280c77

The ARGUMENTS variable is used to store arguments passed from

280c77
command-line for later use inside <tt>`centos-art.sh'</tt> script. Storing
280c77
arguments is specially useful when we want to run a command with some
280c77
specific options from them. Consider the following command:
280c77

280c77
centos-art path --copy=SOURCE --to=TARGET --message="The commit message goes here." --username='johndoe'
280c77
280c77

In the above command, the <samp>`--message'</samp>, and <samp>`--username'</samp>

280c77
options are specific to svn copy command. In such cases,
280c77
options are not interpreted by <tt>`centos-art.sh'</tt> script itself.
280c77
Instead, the <tt>`centos-art.sh'</tt> script uses getopt to
280c77
retrive them and store them in the ARGUMENTS variable for later
280c77
use, as described in the following command:
280c77

280c77
# Build subversion command to duplicate locations inside the
280c77
# workstation.
280c77
eval svn copy $SOURCE $TARGET --quiet $ARGUMENTS
280c77
280c77

When getopt parses ARGUMENTS, we may use short options

280c77
(e.g., <samp>`-m'</samp>) or long options (e.g., <samp>`--message'</samp>). When
280c77
we use short options, arguments are separated by one space from the
280c77
option (e.g., <samp>`-m 'This is a commit message.''</samp>).  When we use
280c77
long options arguments are separated by an equal sign (<samp>`='</samp>)
280c77
(e.g., <samp>`--message='This is a commit message''</samp>).
280c77

280c77

In order for getopt to parse ARGUMENTS correctly, it

280c77
is required to provide the short and long definition of options that
280c77
will be passed or at least supported by the command performing the
280c77
final action the function script exists for.
280c77

280c77

As convenction, inside <tt>`centos-art.sh'</tt> script, short option

280c77
definitions are set in the ARGSS variable; and long option
280c77
definitions are set in the ARGSL variable.
280c77

280c77

When you define short and long options, it may be needed to define

280c77
which of these option arguments are required and which not. To define
280c77
an option argument as required, you need to set one colon <samp>`:'</samp>
280c77
after the option definition (e.g., <samp>`-o m: -l message:'</samp>).  On
280c77
the other hand, to define an option argument as not required, you need
280c77
to set two colons <samp>`::'</samp> after the option definition (e.g.,
280c77
<samp>`-o m:: -l message::'</samp>).
280c77

280c77
280c77
280c77
<u>Variable:</u> EDITOR
280c77
280c77
280c77

Default text editor.

280c77

280c77

The <tt>`centos-art.sh'</tt> script uses default text EDITOR to edit

280c77
pre-commit subversion messages, translation files, configuration
280c77
files, script files, and similar text-based files.
280c77

280c77

If EDITOR environment variable is not set, <tt>`centos-art.sh'</tt>

280c77
script uses <tt>`/usr/bin/vim'</tt> as default text editor. Otherwise, the
280c77
following values are recognized by <tt>`centos-art.sh'</tt> script:
280c77

63f275
    280c77
  • <tt>`/usr/bin/vim'</tt>
  • 280c77
  • <tt>`/usr/bin/emacs'</tt>
  • 280c77
  • <tt>`/usr/bin/nano'</tt>
  • 63f275
    63f275
    280c77

    If no one of these values is set in EDITOR environment variable,

    280c77
    <tt>`centos-art.sh'</tt> uses <tt>`/usr/bin/vim'</tt> text editor by default. 
    280c77

    280c77
    54264c
    01b527
    280c77

    3.38.3.2 Global functions

    6414c4
    280c77

    Function scripts stored directly under

    280c77
    <tt>`trunk/Scripts/Bash/Functions/'</tt> directory are used to define
    280c77
    global functions.  Global functions can be used inside action specific
    280c77
    functionalities and or even be reused inside themselves. This section
    280c77
    provides introductory information to global functions you can use
    280c77
    inside <tt>`centos-art.sh'</tt> script.
    280c77

    280c77
    280c77
    <u>Function:</u> cli_checkActionArguments
    280c77
    280c77
    280c77

    Validate action value (ACTIONVAL) variable.

    280c77

    280c77

    The action value variable can take one of the following values:

    280c77

    280c77
      280c77
    1. Path to one directory inside the local working copy,
    2. 280c77
    3. Path to one file inside the local working copy,
    4. 280c77
      280c77
      280c77

      If another value different from that specified above is passed to

      280c77
      action value variable, the <tt>`centos-art.sh'</tt> script prints an error
      280c77
      message and ends script execution.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      280c77
      280c77
      280c77

      Verify file existence.

      280c77

      280c77

      cli_checkFiles receives a FILE absolute path and performs

      280c77
      file verification as specified in TYPE.  When TYPE is not
      280c77
      specified, cli_checkFiles verifies FILE existence, no
      280c77
      matter what kind of file it be.  If TYPE is specified, use one
      280c77
      of the following values:
      280c77

      280c77
      280c77
      <samp>`d'</samp>
      280c77
      <samp>`directory'</samp>
      280c77

      Ends script execution if FILE is not a directory.

      280c77

      280c77

      When you verify directories with cli_checkFiles, if directory doesn't

      280c77
      exist, <tt>`centos-art.sh'</tt> script asks you for confirmation in order
      280c77
      to create that directory. If you answer positively,
      280c77
      <tt>`centos-art.sh'</tt> script creates that directory and continues
      280c77
      script flows normally. Otherwise, if you answer negatively,
      280c77
      <tt>`centos-art.sh'</tt> ends script execution with an error and
      280c77
      documentation message.
      280c77

      280c77
      280c77
      <samp>`f'</samp>
      280c77
      <samp>`regular-file'</samp>
      280c77

      Ends script execution if FILE is not a regular file.

      280c77

      280c77
      <samp>`h'</samp>
      280c77
      <samp>`symbolic-link'</samp>
      280c77

      Ends script execution if FILE is not a symbolic link.

      280c77

      280c77
      <samp>`x'</samp>
      280c77
      <samp>`execution'</samp>
      280c77

      Ends script execution if FILE is not executable.

      280c77

      280c77
      <samp>`fh'</samp>
      280c77

      Ends script execution if FILE is neither a regular file nor a

      280c77
      symbolic link.
      280c77

      280c77
      <samp>`fd'</samp>
      280c77

      Ends script execution if FILE is neither a regular file nor a

      280c77
      directory.
      280c77

      280c77
      <samp>`isInWorkingCopy'</samp>
      280c77

      Ends script execution if FILE is not inside the working copy.

      280c77

      280c77
      280c77
      280c77

      As default behaviour, if FILE passes all verifications,

      280c77
      <tt>`centos-art.sh'</tt> script continues with its normal flow. 
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_commitRepoChanges [LOCATION]
      280c77
      280c77
      280c77

      Syncronize changes between repository and working copy.

      280c77

      280c77

      The cli_commitRepoChanges function brings changes from the

      280c77
      central repository down to the working copy--using svn
      280c77
      update--, checks the working copy changes--using svn
      280c77
      status command--, prints status report--using both svn
      280c77
      update and svn status commands output, and finally, commits
      280c77
      recent changes from the working copy up to the repository--using
      280c77
      svn commit command--.
      280c77

      280c77

      Previous to commit the working copy changes up to the central

      280c77
      repository, the cli_commitRepoChanges function asks you to
      280c77
      verify changes--using svn diff command--, and later,
      280c77
      another confirmation question is shown to be sure you really want to
      280c77
      commit changes up to central repository.
      280c77

      280c77

      If LOCATION argument is not specified, the value of

      280c77
      ACTIONVAL variable is used as reference instead.
      280c77

      280c77
      280c77
      ----------------------------------------------------------------------
      280c77
      --> Bringing changes from the repository into the working copy
      280c77
      --> Checking changes in the working copy
      280c77
      ----------------------------------------------------------------------
      280c77
      Added           0 file from the repository.
      280c77
      Deleted         0 file from the repository.
      280c77
      Updated         0 file from the repository.
      280c77
      Conflicted      0 file from the repository.
      280c77
      Merged          0 file from the repository.
      280c77
      Modified        4 files from the working copy.
      280c77
      Unversioned     0 file from the working copy.
      280c77
      Deleted         0 file from the working copy.
      280c77
      Added           0 file from the working copy.
      280c77
      ----------------------------------------------------------------------
      280c77
      280c77

      Figure 3.14: The cli_commitRepoChanges function output.

      280c77
      280c77

      280c77

      Call the cli_commitRepoChanges function before or/and after

      280c77
      calling functions that modify files or directories inside the working
      280c77
      copy as you may need to.  
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_doParseArguments
      280c77
      280c77
      280c77

      Redefine arguments (ARGUMENTS) global variable using

      280c77
      getopt command output. For more information about how to use
      280c77
      cli_doParseArguments function, see ARGUMENTS variable
      280c77
      description above.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_doParseArgumentsReDef $@
      280c77
      280c77
      280c77

      Initialize/reset arguments (ARGUMENTS) global variable using

      280c77
      positional parameters variable ($@) as reference.
      280c77

      280c77

      When we work inside function definitions, positional parameters are

      280c77
      reset to the last function definition positional parameters.  If you
      280c77
      need to redefine positional parameters from one specific function, you
      280c77
      need to call cli_doParseArgumentsReDef with the positional
      280c77
      parameters variable ($@), set as first argument, to that
      280c77
      specific function you want to redefine positional parameters at.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getArguments
      280c77
      280c77
      280c77

      Initialize function name (FUNCNAM), action name

      280c77
      (ACTIONNAM), and action value (ACTIONVAL) global
      280c77
      variables, using positional parameters passed in $@ variable.
      280c77

      280c77

      The cli_getArguments function is called from cli.sh

      280c77
      function script, using cli function's positional parameters
      280c77
      (i.e., the positional parameters passed as arguments in the
      280c77
      command-line) as first function argument. 
      280c77

      280c77

      Once command-line positional parameters are accesible to

      280c77
      <tt>`centos-art.sh'</tt> script execution evironment,
      280c77
      cli_getArguments uses regular expression to retrive
      280c77
      action variables from first and second argument. The first argument
      280c77
      defines the value used as function name (FUNCNAM), and the
      280c77
      second argument defines both values used as action name
      280c77
      (ACTIONNAM) and action value (ACTIONVAL), respectively.
      280c77

      280c77

      The first argument is a word in lower case. This word specifies the

      280c77
      name of the functionality you want to use (e.g., <samp>`render'</samp> to
      280c77
      render images, <samp>`manual'</samp> to work on documentation, and so on.)
      280c77

      280c77

      The second argument has a long option style (e.g.,

      280c77
      <samp>`--option=value'</samp>). The <samp>`--option'</samp> represents the action name
      280c77
      (ACTIONNAM), and the characters inbetween the equal sign
      280c77
      (<samp>`='</samp>) and the first space character, are considered as the action
      280c77
      value (ACTIONVAL). In order to provide action values with space
      280c77
      characters inbetween you need to enclose action value with quotes like
      280c77
      in <samp>`--option='This is long value with spaces inbetween''</samp>.
      280c77
      Generally, action values are used to specify paths over which the
      280c77
      action name acts on.
      280c77

      280c77

      Once action related variables (i.e., FUNCNAM, ACTIONNAM,

      280c77
      and ACTIONVAL) are defined and validated,
      280c77
      cli_getArguments shifts the positional arguments to remove the
      280c77
      first two arguments passed (i.e., those used to retrive action related
      280c77
      variables) and redefine the arguments (ARGUMENTS) global
      280c77
      variable with the new positional parameters information.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getFunctions
      280c77
      280c77
      280c77

      Initialize funtionalities supported by <tt>`centos-art.sh'</tt> script.

      280c77

      280c77

      Functionalities supported by <tt>`centos-art.sh'</tt> script are organized

      280c77
      in functionality directories under
      280c77
      <tt>`trunk/Scripts/Bash/Functions/'</tt> directory. Each functionality
      280c77
      directory stores function scripts to the functionality such directory
      280c77
      was created for. Function scripts contain function definitions.
      280c77
      Function definitions contain several commands focused on achieving one
      280c77
      specific task only (i.e., the one such functionality was created for).
      280c77

      280c77

      In order for <tt>`centos-art.sh'</tt> script to recognize a functionality,

      280c77
      such functionality needs to be stored under
      280c77
      <tt>`trunk/Scripts/Bash/Functions/'</tt> in a directory written
      280c77
      capitalized (i.e., the whole name is written in lowercase except the
      280c77
      first character which is in uppercase). The directory where one
      280c77
      specific functionality is stored is known as the <samp>`functionality
      280c77
      directory'</samp>. 
      280c77

      280c77

      Inside each functionality directory, the functionalty itself is

      280c77
      implemented through function scripts. Function scripts are organized
      280c77
      in files independently one another and written in <samp>`camelCase'</samp>
      280c77
      format with the function name as prefix.  Separation between prefix
      280c77
      and description is done using underscore (<samp>`_'</samp>) character.
      280c77

      280c77

      In order for <tt>`centos-art.sh'</tt> script to load functionalities

      280c77
      correctly, function definition inside function scripts should be set
      280c77
      using the <samp>`function'</samp> reserved word, just as in the following
      280c77
      example:
      280c77

      280c77
      function prefix_doSomething {
      280c77
      280c77
          # Do something here...
      280c77
      280c77
      }
      280c77
      280c77

      The above function definition is just a convenction we use, in order

      280c77
      to make identification of function names easier read and automate by
      280c77
      <tt>`centos-art.sh'</tt> script initialization commands, once
      280c77
      <tt>`centos-art.sh'</tt> script determines which functionality directory
      280c77
      to use.  Specifically, in order to initialize and export functions,
      280c77
      <tt>`centos-art.sh'</tt> script executes all function scripts inside the
      280c77
      functionality directory, and later grep on them using a
      280c77
      regular expression pattern, where the <samp>`function'</samp> reserved word is
      280c77
      used as reference to retrive the function names and export them to
      280c77
      <tt>`centos-art.sh'</tt> script execution environment, and so, make
      280c77
      function definitions --from function scripts inside the functionality
      280c77
      directory-- available for further calls.
      280c77

      280c77

      If the functionality specified in the command-line first argument

      280c77
      doesn't have a functionality directory, <tt>`centos-art.sh'</tt> script
      280c77
      considers the functionality provided in the command-line as invalid
      280c77
      functionality and immediatly stops script execution with an error
      280c77
      message.
      280c77

      280c77

      In order to keep visual consistency among function scripts, please

      280c77
      consider using the following function script design model as template
      280c77
      for your own function scripts:
      280c77

      280c77
      #!/bin/bash
      280c77
      #
      280c77
      # prefix_doSomething.sh -- This function illustrates function scripts
      280c77
      # design model you can use to create your own function scripts inside
      280c77
      # centos-art.sh script.
      280c77
      #
      280c77
      # Copyright (C) YEAR YOURFULLNAME
      280c77
      #
      280c77
      # This program is free software; you can redistribute it and/or modify
      280c77
      # it under the terms of the GNU General Public License as published by
      280c77
      # the Free Software Foundation; either version 2 of the License, or
      280c77
      # (at your option) any later version.
      280c77
      # 
      280c77
      # This program is distributed in the hope that it will be useful, but
      280c77
      # WITHOUT ANY WARRANTY; without even the implied warranty of
      280c77
      # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      280c77
      # General Public License for more details.
      280c77
      #
      280c77
      # You should have received a copy of the GNU General Public License
      280c77
      # along with this program; if not, write to the Free Software
      280c77
      # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
      280c77
      # USA.
      280c77
      # 
      280c77
      # ----------------------------------------------------------------------
      280c77
      # $Id$
      280c77
      # ----------------------------------------------------------------------
      280c77
      280c77
      function prefix_doSomething {
      280c77
      280c77
          # Do something here...
      280c77
      280c77
      }
      280c77
      280c77
      280c77
      280c77
      <u>Function:</u> cli_getCountryCodes [FILTER]
      280c77
      280c77
      280c77

      Output country codes supported by <tt>`centos-art.sh'</tt> script.

      280c77

      280c77

      The cli_getCountryCodes function outputs a list with country

      280c77
      codes as defined in ISO3166 standard. When FILTER is provided,
      280c77
      cli_getCountryCodes outputs country codes that match
      280c77
      FILTER regular expression pattern.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getCountryName [FILTER]
      280c77
      280c77
      280c77

      Outputs country name supported by <tt>`centos-art.sh'</tt> script.

      280c77

      280c77

      The cli_getCountryName function reads one language locale code

      280c77
      in the format LL_CC and outputs the name of its related country as in
      280c77
      ISO3166. If filter is specified, cli_getCountryName returns the
      280c77
      country name that matches the locale code specified in FILTER,
      280c77
      exactly.
      280c77

      280c77
       
      280c77
      280c77
      <u>Function:</u> cli_getCurrentLocale
      280c77
      280c77
      280c77

      Output current locale used by <tt>`centos-art.sh'</tt> script.

      280c77

      280c77

      The cli_getCurrentLocale function uses LANG environment

      280c77
      variable to build a locale pattern that is later applied to
      280c77
      cli_getLocales function output in order to return the current
      280c77
      locale that <tt>`centos-art.sh'</tt> script works with. 
      280c77

      280c77

      The current locale information, returned by

      280c77
      cli_getCurrentLocale, is output from more specific to less
      280c77
      specific. For example, if <samp>`en_GB'</samp> locale exists in
      280c77
      cli_getLocales function output, the <samp>`en_GB'</samp> locale would
      280c77
      take precedence before <samp>`en'</samp> locale.
      280c77

      280c77

      Locale precedence selection is quite important in order to define the

      280c77
      locale type we use for message translations. For example, if
      280c77
      <samp>`en_GB'</samp> is used, we are also saying that the common language
      280c77
      specification for English language (i.e., <samp>`en'</samp>) is no longer
      280c77
      used. Instead, we are using English non-common country-specific
      280c77
      language specifications like <samp>`en_AU'</samp>, <samp>`en_BW'</samp>, <samp>`en_GB'</samp>,
      280c77
      <samp>`en_US'</samp>, etc., for message translations.  
      280c77

      280c77

      Use cli_getCurrentLocale function to know what current locale

      280c77
      information to use inside <tt>`centos-art.sh'</tt> script.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getFilesList [LOCATION]
      280c77
      280c77
      280c77

      Output list of files to process.

      280c77

      280c77

      The cli_getFilesList function uses LOCATION variable as

      280c77
      source location to build a list of files just as specified by regular
      280c77
      expression (REGEX) global variable. Essentially, what the
      280c77
      cli_getFilesList function does is using find command
      280c77
      to look for files in the location (LOCATION) just as posix-egrep
      280c77
      regular expression (REGEX) specifies. 
      280c77

      280c77

      If LOCATION is not specified when cli_getFilesList

      280c77
      function is called, the action value (ACTIONVAL) global variable
      280c77
      is used as location value instead.
      280c77

      280c77

      By default, if the regular expression (REGEX) global variable is

      280c77
      not redefined after its first definition in the cli function,
      280c77
      all files that match default regular expression value (i.e.,
      280c77
      <samp>`.+'</samp>) will be added to the list of files to process. Otherwise,
      280c77
      if you redefine the regular expression global variable after its first
      280c77
      definition in the cli function and before calling
      280c77
      cli_getFilesList function, the last value you specifed is used
      280c77
      instead.
      280c77

      280c77

      When you need to customize the regular expression (REGEX) global

      280c77
      variable value inside a function, do not redefine the global variable
      280c77
      (at least you be absolutly convinced you need to).  Instead, set the
      280c77
      regular expression global variable as <samp>`local'</samp> to the function you
      280c77
      need a customized regular expression value for.  If we don't redefine
      280c77
      the regular expression global variable as local to the function, or
      280c77
      use another name for the regular expression variable (which is not
      280c77
      very convenient in order to keep the amount of names to remember low),
      280c77
      you may experiment undesired concantenation issues that make your
      280c77
      regular expression to be something different from that you expect them
      280c77
      to be, specially if the function where you are doing the variable
      280c77
      redefinition is called several times during the same script execution.
      280c77

      280c77

      As result, the cli_getFilesList re-defines the value of

      280c77
      FILES variable with the list of files the find command
      280c77
      returned. As example, consider the following construction:
      280c77

      280c77
      function prefix_doSomething {
      280c77
      280c77
          # Initialize the list of files to process.
      280c77
          local FILES=''
      280c77
      280c77
          # Initialize location.
      280c77
          local LOCATION=/home/centos/artwork/trunk/Identity/Themes/Models/Default
      280c77
      280c77
          # Re-define regular expression to match scalable vector graphic
      280c77
          # files only. Note how we use the global value of REGEX to build a
      280c77
          # new local REGEX value here.
      280c77
          local REGEX="${REGEX}.*\.(svgz|svg)"
      280c77
      280c77
          # Redefine list of files to process.
      280c77
          cli_getFilesList $LOCATION
      280c77
      280c77
          # Process list of files.
      280c77
          for FILE in $FILES;do
      280c77
              cli_printMessages "$FILE" 'AsResponseLine'
      280c77
              # Do something else here on...
      280c77
          done
      280c77
      280c77
      }
      280c77
      280c77
      280c77
      280c77
      280c77
      <u>Function:</u> cli_getLangCodes [FILTER]
      280c77
      280c77
      280c77

      Outputs language codes supported by <tt>`centos-art.sh'</tt> script.

      280c77

      280c77

      cli_getLangCodes function outputs a list of language codes as

      280c77
      defined in ISO639 standard. When FILTER is provided,
      280c77
      cli_getLangCodes outputs language codes that match FILTER
      280c77
      regular expression pattern.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getLangName [FILTER]
      280c77
      280c77
      280c77

      Outputs language names supported by <tt>`centos-art.sh'</tt> script.

      280c77

      280c77

      cli_getLangName function reads one language locale code in the

      280c77
      format LL_CC and outputs the language related name as in ISO639. If
      280c77
      filter is specified, cli_getLangName returns the language name
      280c77
      that matches the locale code specified in FILTER, exactly.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getLocales
      280c77
      280c77
      280c77

      Output locale codes supported by <tt>`centos-art.sh'</tt> script.

      280c77

      280c77

      Occasionally, you use cli_getLocales function to add locale

      280c77
      information in non-common country-specific language (<samp>`LL_CC'</samp>)
      280c77
      format for those languages (e.g., <samp>`bn_IN'</samp>, <samp>`pt_BR'</samp>, etc.)
      280c77
      which locale differences cannot be solved using common language
      280c77
      specifications (<samp>`LL'</samp>) into one unique common locale specification
      280c77
      (e.g., <samp>`bn'</samp>, <samp>`pt'</samp>, etc.).  
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getRepoName NAME TYPE
      280c77
      280c77
      280c77

      Sanitate file names.

      280c77

      280c77

      Inside <tt>`centos-art.sh'</tt> script, specific functionalities rely both

      280c77
      in cli_getRepoName and repository file system organization to
      280c77
      achieve their goals.  Consider cli_getRepoName function as
      280c77
      central place to manage file name convenctions for other functions
      280c77
      inside <tt>`centos-art.sh'</tt> script.
      280c77

      280c77
      Important

      Important

      cli_getRepoName function doesn't verify file

      280c77
      or directory existence, for that purpose use cli_checkFiles
      280c77
      function instead.
      280c77

      280c77
      280c77

      The NAME variable contains the file name or directory name you

      280c77
      want to sanitate.
      280c77

      280c77

      The TYPE variable specifies what type of sanitation you want to

      280c77
      perform on NAME. The TYPE can be one of the following
      280c77
      values:
      280c77

      280c77
      280c77
      <samp>`d'</samp>
      280c77
      <samp>`directory'</samp>
      280c77

      Sanitate directory NAMEs.

      280c77

      280c77
      <samp>`f'</samp>
      280c77
      <samp>`regular-file'</samp>
      280c77

      Sanitate regular file NAMEs.

      280c77

      280c77
      280c77
      280c77

      Use cli_getRepoName function to sanitate file names and

      280c77
      directory names before their utilization. 
      280c77

      280c77

      Use cli_getRepoName when you need to change file name

      280c77
      convenctions inside <tt>`centos-art.sh'</tt> script. 
      280c77

      280c77

      When we change file name convenctions inside cli_getRepoName

      280c77
      what we are really changing is the way functions interpret repository
      280c77
      file system organization. Notice that when we change a file name
      280c77
      (e.g., a function name), it is necessary to update all files where
      280c77
      such file name is placed on. This may require a massive substitution
      280c77
      inside the repository, each time we change name convenctions in the
      280c77
      repository (see section trunk/Scripts/Bash/Functions/Path, for more
      280c77
      information).
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getRepoStatus [LOCATION]
      280c77
      280c77
      280c77

      Request repository status.

      280c77

      280c77

      This function requests the status of a LOCATION inside the

      280c77
      working copy using the svn status command and returns the
      280c77
      first character in the output line, just as described in svn
      280c77
      help status. If LOCATION is not a regular file or a directory,
      280c77
      inside the working copy, the <tt>`centos-art.sh'</tt> script prints a
      280c77
      message and ends its execution.
      280c77

      280c77

      Use this function to perform verifications based a repository

      280c77
      LOCATION status.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getTemporalFile NAME
      280c77
      280c77
      280c77

      Output absolute path to temporal file NAME.

      280c77

      280c77

      The cli_getTemporalFile function uses <tt>`/tmp'</tt> directory as

      280c77
      source location to store temporal files, the <tt>`centos-art.sh'</tt>
      280c77
      script name, and a random identification string to let you run more
      280c77
      than one <tt>`centos-art.sh'</tt> script simultaneously on the same user
      280c77
      session.  For example, due the following temporal file defintion:
      280c77

      280c77
      cli_getTemporalFile $FILE
      280c77
      280c77

      If FILE name is <tt>`instance.svg'</tt> and the unique random string

      280c77
      is <samp>`f16f7b51-ac12-4b7f-9e66-72df847f12de'</samp>, the final temporal
      280c77
      file, built from previous temporal file definition, would be:
      280c77

      280c77
      /tmp/centos-art.sh-f16f7b51-ac12-4b7f-9e66-72df847f12de-instance.svg
      280c77
      280c77

      When you use the cli_getTemporalFile function to create

      280c77
      temporal files, be sure to remove temporal files created once you've
      280c77
      ended up with them.  For example, consider the following construction:
      280c77

      280c77
      for FILE in $FILES;do
      280c77
      280c77
          # Initialize temporal instance of file.
      280c77
          INSTANCE=$(cli_getTemporalFile $FILE)
      280c77
      280c77
          # Do something ... 
      280c77
      280c77
          # Remove temporal instance of file.
      280c77
          if [[ -f $INSTANCE ]];then
      280c77
              rm $INSTANCE
      280c77
          fi
      280c77
      280c77
      done
      280c77
      280c77

      Use the cli_getTemporalFile function whenever you need to

      280c77
      create temporal files inside <tt>`centos-art.sh'</tt> script.
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_getThemeName
      280c77
      280c77
      280c77

      Output theme name.

      280c77

      280c77

      In order for cli_getThemeName function to extract theme name

      280c77
      correctly, the ACTIONVAL variable must contain a directory path
      280c77
      under <tt>`trunk/Identity/Themes/Motifs/'</tt> directory structure.
      280c77
      Otherwise, cli_getThemeName returns an empty string.  
      280c77

      280c77
      280c77
      280c77
      <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
      280c77
      280c77
      280c77

      Define standard output message definition supported by

      280c77
      <tt>`centos-art.sh'</tt> script.
      280c77

      280c77

      When FORMAT is not specified, cli_printMessage outputs

      280c77
      information just as it was passed in MESSAGE variable.
      280c77
      Otherwise, FORMAT can take one of the following values:
      280c77

      280c77
      280c77
      <samp>`AsHeadingLine'</samp>
      280c77

      To print heading messages.

      280c77

      ----------------------------------------------------------------------
      280c77
      $MESSAGE
      280c77
      ----------------------------------------------------------------------
      280c77
      280c77
      280c77
      <samp>`AsWarningLine'</samp>
      280c77

      To print warning messages.

      280c77

      ----------------------------------------------------------------------
      280c77
      WARNING: $MESSAGE
      280c77
      ----------------------------------------------------------------------
      280c77
      280c77
      280c77
      <samp>`AsNoteLine'</samp>
      280c77

      To print note messages.

      280c77

      ----------------------------------------------------------------------
      280c77
      NOTE: $MESSAGE
      280c77
      ----------------------------------------------------------------------
      280c77
      280c77
      280c77
      <samp>`AsUpdatingLine'</samp>
      280c77

      To print <samp>`Updating'</samp> messages on two-columns format.

      280c77

      Updating        $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsRemovingLine'</samp>
      280c77

      To print <samp>`Removing'</samp> messages on two-columns format.

      280c77

      Removing        $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsCheckingLine'</samp>
      280c77

      To print <samp>`Checking'</samp> messages on two-columns format.

      280c77

      Checking        $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsCreatingLine'</samp>
      280c77

      To print <samp>`Creating'</samp> messages on two-columns format.

      280c77

      Creating        $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsSavedAsLine'</samp>
      280c77

      To print <samp>`Saved as'</samp> messages on two-columns format.

      280c77

      Saved as        $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsLinkToLine'</samp>
      280c77

      To print <samp>`Linked to'</samp> messages on two-columns format.

      280c77

      Linked to       $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsMovedToLine'</samp>
      280c77

      To print <samp>`Moved to'</samp> messages on two-columns format.

      280c77

      Moved to        $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsTranslationLine'</samp>
      280c77

      To print <samp>`Translation'</samp> messages on two-columns format.

      280c77

      Translation     $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsConfigurationLine'</samp>
      280c77

      To print <samp>`Configuration'</samp> messages on two-columns format.

      280c77

      Configuration   $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsResponseLine'</samp>
      280c77

      To print response messages on one-column format.

      280c77

      --> $MESSAGE
      280c77
      280c77
      280c77
      <samp>`AsRequestLine'</samp>
      280c77

      To print request messages on one-column format. Request messages

      280c77
      output messages with one colon (<samp>`:'</samp>) and without trailing newline
      280c77
      (<samp>`\n'</samp>) at message end.
      280c77

      $MESSAGE:
      280c77
      280c77
      280c77
      <samp>`AsYesOrNoRequestLine'</samp>
      280c77

      To print <samp>`yes or no'</samp> request messages on one-column format. If

      280c77
      something different from <samp>`y'</samp> is answered (when using
      280c77
      en_US.UTF-8 locale), script execution ends immediatly.  
      280c77

      280c77
      $MESSAGE [y/N]:
      280c77
      280c77

      When we use <tt>`centos-art.sh'</tt> script in a locale different from

      280c77
      en_US.UTF-8, confirmation answer may be different from
      280c77
      <samp>`y'</samp>. For example, if you use es_ES.UTF-8 locale, the
      280c77
      confirmation question would look like:
      280c77

      280c77
      $MESSAGE [s/N]:
      280c77
      280c77

      and the confirmation answer would be <samp>`s'</samp>, as it is on Spanish

      280c77
      <samp>`sí'</samp> word.
      280c77

      280c77

      Definition of which confirmation word to use is set on translation

      280c77
      messages for your specific locale information. See section trunk/Scripts/Bash/Functions/Locale, for more information about locale-specific
      280c77
      translation messages.
      280c77

      280c77
      280c77
      <samp>`AsToKnowMoreLine'</samp>
      280c77

      To standardize <samp>`to know more, run the following command:'</samp>

      280c77
      messages. When the <samp>`AsToKnowMoreLine'</samp> option is used, the
      280c77
      MESSAGE value should be set to "$(caller)". caller
      280c77
      is a Bash builtin that returns the context of the current subroutine
      280c77
      call. <samp>`AsToKnowMoreLine'</samp> option uses caller builtin
      280c77
      output to build documentation entries dynamically.
      280c77

      280c77
      ----------------------------------------------------------------------
      280c77
      To know more, run the following command:
      280c77
      centos-art manual --read='path/to/dir'
      280c77
      ----------------------------------------------------------------------
      280c77
      280c77

      Use <samp>`AsToKnowMoreLine'</samp> option after errors and for intentional

      280c77
      script termination. 
      280c77

      280c77
      280c77
      <samp>`AsRegularLine'</samp>
      280c77

      To standardize regular messages on one-column format.

      280c77

      280c77

      When MESSAGE contains a colon inside (e.g., <samp>`description:

      280c77
      message'</samp>), the cli_printMessage function outputs MESSAGE
      280c77
      on two-columns format. 
      280c77

      280c77
      280c77
      280c77

      Use cli_printMessage function whenever you need to output

      280c77
      information from <tt>`centos-art.sh'</tt> script.
      280c77

      280c77
      Info

      Tip

      To improve two-columns format, change the following file:

      280c77

      trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
      280c77
      280c77
      63f275
      63f275
      01b527
      280c77

      3.38.3.3 Specific functions

      54264c
      280c77

      The following specific functions of <tt>`centos-art.sh'</tt> script, are

      280c77
      available for you to use:
      280c77

      280c77
      280c77
      3.39 trunk/Scripts/Bash/Functions/Html  
      280c77
      280c77
      3.40 trunk/Scripts/Bash/Functions/Locale  
      280c77
      280c77
      3.41 trunk/Scripts/Bash/Functions/Manual  
      280c77
      280c77
      3.42 trunk/Scripts/Bash/Functions/Path  
      280c77
      280c77
      3.43 trunk/Scripts/Bash/Functions/Render  
      280c77
      280c77
      3.44 trunk/Scripts/Bash/Functions/Render/Config  
      280c77
      280c77
      3.45 trunk/Scripts/Bash/Functions/Shell  
      280c77
      280c77
      3.46 trunk/Scripts/Bash/Functions/Svg  
      280c77
      280c77
      3.47 trunk/Scripts/Bash/Functions/Verify  
      280c77
      280c77
      54264c
      63f275
      01b527
      54264c

      3.38.4 See also

      4c79b5
      280c77
      280c77
      3.37 trunk/Scripts/Bash  
      280c77
      280c77
      3.48 trunk/Scripts/Bash/Locale  
      280c77
      280c77
      4c79b5
      6ba043
      4c79b5
      01b527
      [ < ]
      01b527
      [ > ]
      4c79b5
         
      4c79b5
      [ << ]
      280c77
      [ Up ]
      280c77
      [ >> ]
      4c79b5
      4c79b5

      4c79b5
       <font size="-1">
      6414c4
        This document was generated on January, 3 2011 using texi2html 1.76.
      4c79b5
       </font>
      4c79b5
       
      4c79b5
      4c79b5

      4c79b5
      </body>
      4c79b5
      </html>