Blame Manual/repository-html/repository_57.html

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

2.52 The <tt>`trunk/Scripts/Bash/Cli/Functions'</tt> Directory

ee1f37
ee1f37
f66721
f66721

2.52.1 Goals

ee1f37
f66721

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

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

b130a0
f66721
f66721

2.52.2 Description

ee1f37
f66721

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

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

f66721

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

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

f66721

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

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

f66721

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

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

f66721
Info

Tip

Join CentOS developers mailing list

f66721
centos-art@centos.org to share your ideas.
f66721

ee1f37
f66721

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

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

f66721

OK, let's begin with our functionality example.

f66721

f66721

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

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

f66721

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

f66721

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

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

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

f66721

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

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

f66721

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

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

f66721

In our greet function example, top commentary for

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

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

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

f66721
function definition would look like the following:
f66721

f66721
function greet {
aaf678
f66721
    # Define global variables.
aaf678
f66721
    # Define command-line interface.
f66721
    greet_getActions
f66721
f66721
}
f66721
f66721

The first definition inside greet function, are global

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

f66721

Later, we call greet_getActions function to define the

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

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

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

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

f66721

The greet function definition makes available two valid

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

f66721

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

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

f66721

The greet_doHello and greet_doBye function definitions

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

f66721
function greet_doHello {
f66721
f66721
    cli_printMessage "`gettext "Hello"` $ACTIONVAL"
f66721
f66721
}
f66721
f66721

The greet_doHello function definition is stored in

f66721
<tt>`greet_doHello.sh'</tt> function script. 
f66721

f66721
function greet_doBye {
f66721
f66721
    cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
f66721
f66721
}
f66721
f66721

The greet_doBye function definition is stored in the

f66721
<tt>`greet_doBye.sh'</tt> function script. 
f66721

f66721

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

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

f66721

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

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

f66721

Let's see how greet specific functionality files are organzied

f66721
under greet function directory. To see file organization we use
f66721
the tree command:
f66721

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

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

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

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

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

f66721
change it to have a little fun.
f66721

f66721

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

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

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

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

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

f66721

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

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

f66721
centos-art locale --edit
f66721
f66721
Warning

Warning

To translate output messages in different languages,

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

f66721
f66721

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

f66721

f66721

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

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

f66721

The greet function described in this section may serve you as

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

f66721

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

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

f66721
f66721
f66721

2.52.3 Usage

f66721
f66721
f66721
f66721

2.52.3.1 Global variables

f66721
f66721

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

f66721
available for you to use inside specific functions:
f66721

f66721
f66721
<u>Variable:</u> TEXTDOMAIN
f66721
f66721
f66721

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

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

f66721
f66721
f66721
<u>Variable:</u> TEXTDOMAINDIR
f66721
f66721
f66721

Default directory used to retrieve translated messages. This value is

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

f66721
f66721
f66721
<u>Variable:</u> FUNCNAM
f66721
f66721
f66721

Define function name.

f66721

f66721

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

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

f66721

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

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

f66721

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

f66721
immediatly ends its execution.
f66721

f66721
f66721
f66721
<u>Variable:</u> FUNCDIR
f66721
f66721
f66721
f66721
f66721
f66721
<u>Variable:</u> FUNCDIRNAME
f66721
f66721
f66721
f66721
f66721
f66721
<u>Variable:</u> FUNCSCRIPT
f66721
f66721
f66721
f66721
f66721
f66721
<u>Variable:</u> FUNCCONFIG
f66721
f66721
f66721
f66721
f66721
f66721
<u>Variable:</u> ACTIONNAM
f66721
f66721
f66721

Define action name.

f66721

f66721

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

f66721
specific function.
f66721

f66721

Action name names aare passed as second argument in

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

f66721

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

f66721
immediatly ends its execution.
f66721

f66721
f66721
f66721
<u>Variable:</u> ACTIONVAL
f66721
f66721
f66721

Define action value.

f66721

f66721

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

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

f66721
f66721
f66721
<u>Variable:</u> REGEX
f66721
f66721
f66721

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

f66721
to process.
f66721

f66721

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

f66721
files.
f66721

f66721

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

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

f66721
f66721
f66721
<u>Variable:</u> ARGUMENTS
f66721
f66721
f66721

Define optional arguments.

f66721

f66721

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

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

f66721

Optional arguments are parsed using getopt command through

f66721
the following base construction: 
f66721

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

Optional arguments provide support to command options inside

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

f66721

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

f66721

In order for getopt to parse ARGUMENTS correctly, it

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

f66721

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

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

f66721

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

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

b9dbd3
f66721
f66721
<u>Variable:</u> EDITOR
f66721
f66721
f66721

Default text editor.

f66721

f66721

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

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

f66721

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

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

063806
    f66721
  • <tt>`/usr/bin/vim'</tt>
  • f66721
  • <tt>`/usr/bin/emacs'</tt>
  • f66721
  • <tt>`/usr/bin/nano'</tt>
  • 063806
    b9dbd3
    f66721

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

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

    b9dbd3
    ee1f37
    f66721
    f66721

    2.52.3.2 Global functions

    f66721
    f66721

    Function scripts stored directly under

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

    f66721
    f66721
    <u>Function:</u> cli_checkActionArguments
    f66721
    f66721
    f66721

    Validate action value (ACTIONVAL) variable.

    f66721

    f66721

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

    f66721

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

      If another value different from that specified above is passed to

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      f66721
      f66721
      f66721

      Verify file existence.

      f66721

      f66721

      cli_checkFiles receives a FILE absolute path and performs

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

      f66721
      f66721
      <samp>`d'</samp>
      f66721
      <samp>`directory'</samp>
      f66721

      Ends script execution if FILE is not a directory.

      f66721

      f66721

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

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

      f66721
      f66721
      <samp>`f'</samp>
      f66721
      <samp>`regular-file'</samp>
      f66721

      Ends script execution if FILE is not a regular file.

      f66721

      f66721
      <samp>`h'</samp>
      f66721
      <samp>`symbolic-link'</samp>
      f66721

      Ends script execution if FILE is not a symbolic link.

      f66721

      f66721
      <samp>`x'</samp>
      f66721
      <samp>`execution'</samp>
      f66721

      Ends script execution if FILE is not executable.

      f66721

      f66721
      <samp>`fh'</samp>
      f66721

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

      f66721
      symbolic link.
      f66721

      f66721
      <samp>`fd'</samp>
      f66721

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

      f66721
      directory.
      f66721

      f66721
      <samp>`isInWorkingCopy'</samp>
      f66721

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

      f66721

      f66721
      f66721
      f66721

      As default behaviour, if FILE passes all verifications,

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_commitRepoChanges [LOCATION]
      f66721
      f66721
      f66721

      Syncronize changes between repository and working copy.

      f66721

      f66721

      The cli_commitRepoChanges function brings changes from the

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

      f66721

      Previous to commit the working copy changes up to the central

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

      f66721

      If LOCATION argument is not specified, the value of

      f66721
      ACTIONVAL variable is used as reference instead.
      f66721

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

      Figure 2.3: The cli_commitRepoChanges function output.

      f66721
      f66721

      f66721

      Call the cli_commitRepoChanges function before or/and after

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_doParseArguments
      f66721
      f66721
      f66721

      Redefine arguments (ARGUMENTS) global variable using

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_doParseArgumentsReDef $@
      f66721
      f66721
      f66721

      Initialize/reset arguments (ARGUMENTS) global variable using

      f66721
      positional parameters variable ($@) as reference.
      f66721

      f66721

      When we work inside function definitions, positional parameters are

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getArguments
      f66721
      f66721
      f66721

      Initialize function name (FUNCNAM), action name

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

      f66721

      The cli_getArguments function is called from cli.sh

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

      f66721

      Once command-line positional parameters are accesible to

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

      f66721

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

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

      f66721

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

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

      f66721

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

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getFunctions
      f66721
      f66721
      f66721

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

      f66721

      f66721

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

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

      f66721

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

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

      f66721

      Inside each functionality directory, the functionalty itself is

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

      f66721

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

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

      f66721
      function prefix_doSomething {
      f66721
      f66721
          # Do something here...
      f66721
      f66721
      }
      f66721
      f66721

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

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

      f66721

      If the functionality specified in the command-line first argument

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

      f66721

      In order to keep visual consistency among function scripts, please

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

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

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

      f66721

      f66721

      The cli_getCountryCodes function outputs a list with country

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getCountryName [FILTER]
      f66721
      f66721
      f66721

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

      f66721

      f66721

      The cli_getCountryName function reads one language locale code

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

      f66721
       
      f66721
      f66721
      <u>Function:</u> cli_getCurrentLocale
      f66721
      f66721
      f66721

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

      f66721

      f66721

      The cli_getCurrentLocale function uses LANG environment

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

      f66721

      The current locale information, returned by

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

      f66721

      Locale precedence selection is quite important in order to define the

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

      f66721

      Use cli_getCurrentLocale function to know what current locale

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getFilesList [LOCATION]
      f66721
      f66721
      f66721

      Output list of files to process.

      f66721

      f66721

      The cli_getFilesList function uses LOCATION variable as

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

      f66721

      If LOCATION is not specified when cli_getFilesList

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

      f66721

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

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

      f66721

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

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

      f66721

      As result, the cli_getFilesList re-defines the value of

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

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

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

      f66721

      f66721

      cli_getLangCodes function outputs a list of language codes as

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getLangName [FILTER]
      f66721
      f66721
      f66721

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

      f66721

      f66721

      cli_getLangName function reads one language locale code in the

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getLocales
      f66721
      f66721
      f66721

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

      f66721

      f66721

      Occasionally, you use cli_getLocales function to add locale

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getRepoName NAME TYPE
      f66721
      f66721
      f66721

      Sanitate file names.

      f66721

      f66721

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

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

      f66721
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      f66721
      f66721

      The NAME variable contains the file name or directory name you

      f66721
      want to sanitate.
      f66721

      f66721

      The TYPE variable specifies what type of sanitation you want to

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

      f66721
      f66721
      <samp>`d'</samp>
      f66721
      <samp>`directory'</samp>
      f66721

      Sanitate directory NAMEs.

      f66721

      f66721
      <samp>`f'</samp>
      f66721
      <samp>`regular-file'</samp>
      f66721

      Sanitate regular file NAMEs.

      f66721

      f66721
      f66721
      f66721

      Use cli_getRepoName function to sanitate file names and

      f66721
      directory names before their utilization. 
      f66721

      f66721

      Use cli_getRepoName when you need to change file name

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

      f66721

      When we change file name convenctions inside cli_getRepoName

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getRepoStatus [LOCATION]
      f66721
      f66721
      f66721

      Request repository status.

      f66721

      f66721

      This function requests the status of a LOCATION inside the

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

      f66721

      Use this function to perform verifications based a repository

      f66721
      LOCATION status.
      f66721

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getTemporalFile NAME
      f66721
      f66721
      f66721

      Output absolute path to temporal file NAME.

      f66721

      f66721

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

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

      f66721
      cli_getTemporalFile $FILE
      f66721
      f66721

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_getThemeName
      f66721
      f66721
      f66721

      Output theme name.

      f66721

      f66721

      In order for cli_getThemeName function to extract theme name

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

      f66721
      f66721
      f66721
      <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
      f66721
      f66721
      f66721

      Define standard output message definition supported by

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

      f66721

      When FORMAT is not specified, cli_printMessage outputs

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

      f66721
      f66721
      <samp>`AsHeadingLine'</samp>
      f66721

      To print heading messages.

      f66721

      ----------------------------------------------------------------------
      f66721
      $MESSAGE
      f66721
      ----------------------------------------------------------------------
      f66721
      f66721
      f66721
      <samp>`AsWarningLine'</samp>
      f66721

      To print warning messages.

      f66721

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

      To print note messages.

      f66721

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

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

      f66721

      Updating        $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsRemovingLine'</samp>
      f66721

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

      f66721

      Removing        $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsCheckingLine'</samp>
      f66721

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

      f66721

      Checking        $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsCreatingLine'</samp>
      f66721

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

      f66721

      Creating        $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsSavedAsLine'</samp>
      f66721

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

      f66721

      Saved as        $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsLinkToLine'</samp>
      f66721

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

      f66721

      Linked to       $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsMovedToLine'</samp>
      f66721

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

      f66721

      Moved to        $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsTranslationLine'</samp>
      f66721

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

      f66721

      Translation     $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsConfigurationLine'</samp>
      f66721

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

      f66721

      Configuration   $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsResponseLine'</samp>
      f66721

      To print response messages on one-column format.

      f66721

      --> $MESSAGE
      f66721
      f66721
      f66721
      <samp>`AsRequestLine'</samp>
      f66721

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

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

      $MESSAGE:
      f66721
      f66721
      f66721
      <samp>`AsYesOrNoRequestLine'</samp>
      f66721

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

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

      f66721
      $MESSAGE [y/N]:
      f66721
      f66721

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

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

      f66721
      $MESSAGE [s/N]:
      f66721
      f66721

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

      f66721
      <samp>`sí'</samp> word.
      f66721

      f66721

      Definition of which confirmation word to use is set on translation

      f66721
      messages for your specific locale information. -- Removed(xref:trunk Scripts
      f66721
      Bash Functions Locale) --, for more information about locale-specific
      f66721
      translation messages.
      f66721

      f66721
      f66721
      <samp>`AsToKnowMoreLine'</samp>
      f66721

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

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

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

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

      f66721
      script termination. 
      f66721

      f66721
      f66721
      <samp>`AsRegularLine'</samp>
      f66721

      To standardize regular messages on one-column format.

      f66721

      f66721

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

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

      f66721
      f66721
      f66721

      Use cli_printMessage function whenever you need to output

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

      f66721
      Info

      Tip

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

      f66721

      trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
      f66721
      f66721
      f66721
      f66721
      f66721
      f66721

      2.52.3.3 Specific functions

      f66721
      f66721

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

      f66721
      available for you to use:
      f66721

      f66721
      f66721
      f66721
      f66721

      2.52.4 See also

      f66721
      f66721
      f66721
      2.50 The <tt>`trunk/Scripts/Bash'</tt> Directory  
      f66721
      f66721
      ee1f37
      ee1f37
      ee1f37
      f66721
      [ < ]
      f66721
      [ > ]
      ee1f37
         
      f66721
      [ << ]
      f66721
      [ Up ]
      f66721
      [ >> ]
      ee1f37
      ee1f37

      ee1f37
       <font size="-1">
      406f69
        This document was generated on March, 1 2011 using texi2html 1.76.
      ee1f37
       </font>
      ee1f37
       
      ee1f37
      ee1f37

      ee1f37
      </body>
      ee1f37
      </html>