Blame Manuals/en/Html/Repository/repository_40.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>
3207df
<title>The CentOS Artwork Repository: 3.37 trunk/Scripts/Bash/Functions</title>
4c79b5
3207df
<meta name="description" content="The CentOS Artwork Repository: 3.37 trunk/Scripts/Bash/Functions">
3207df
<meta name="keywords" content="The CentOS Artwork Repository: 3.37 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
01b527
[ < ]
01b527
[ > ]
4c79b5
   
4c79b5
[ << ]
4c79b5
[ Up ]
3207df
[ >> ]
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
[Top]
4c79b5
[Contents]
3207df
[Index]
4c79b5
[ ? ]
4c79b5
3207df
01b527
3207df

3.37 trunk/Scripts/Bash/Functions

4c79b5
4c79b5
01b527
6ba043

3.37.1 Goals

6ba043
3207df

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

3207df
<tt>`centos-art.sh'</tt> specific functionalities.
54b5a5

6ba043
01b527
6ba043

3.37.2 Description

6ba043
3207df

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

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

3207df

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

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

3207df

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

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

3207df

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

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

3207df
Info

Tip

Join CentOS developers mailing list

3207df
centos-art@centos.org to share your ideas.
3207df

3207df
3207df

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

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

3207df

OK, let's begin with our functionality example.

3207df

3207df

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

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

3207df

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

3207df

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

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

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

3207df

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

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

3207df

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

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

3207df

In our greet function example, top commentary for

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

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

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

3207df
function definition would look like the following:
3207df

3207df
function greet {
3207df
3207df
    # Define global variables.
3207df
3207df
    # Define command-line interface.
3207df
    greet_getActions
3207df
3207df
}
3207df
3207df

The first definition inside greet function, are global

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

3207df

Later, we call greet_getActions function to define the

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

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

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

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

3207df

The greet function definition makes available two valid

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

3207df

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

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

3207df

The greet_doHello and greet_doBye function definitions

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

3207df
function greet_doHello {
3207df
3207df
    cli_printMessage "`gettext "Hello"` $ACTIONVAL"
3207df
3207df
}
3207df
3207df

The greet_doHello function definition is stored in

3207df
<tt>`greet_doHello.sh'</tt> function script. 
3207df

3207df
function greet_doBye {
3207df
3207df
    cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
3207df
3207df
}
3207df
3207df

The greet_doBye function definition is stored in the

3207df
<tt>`greet_doBye.sh'</tt> function script. 
3207df

3207df

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

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

3207df

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

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

3207df

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

3207df
change it to have a little fun.
3207df

3207df

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

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

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

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

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

3207df

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

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

3207df
centos-art locale --edit
3207df
3207df
Warning

Warning

To translate output messages in different languages,

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

3207df
3207df

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

3207df

3207df

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

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

3207df

The greet function described in this section may serve you as

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

3207df

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

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

6ba043
01b527
6ba043

3.37.3 Usage

6ba043
63f275
6414c4
3207df

3.37.3.1 Global variables

3207df
3207df

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

3207df
available for you to use inside specific functions:
3207df

3207df
3207df
<u>Variable:</u> TEXTDOMAIN
3207df
3207df
3207df

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

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

3207df
3207df
3207df
<u>Variable:</u> TEXTDOMAINDIR
3207df
3207df
3207df

Default directory used to retrieve translated messages. This value is

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

6ba043
3207df
3207df
<u>Variable:</u> FUNCNAM
3207df
3207df
3207df

Define function name.

3207df

3207df

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

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

3207df

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

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

3207df

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

3207df
immediatly ends its execution.
3207df

3207df
3207df
3207df
<u>Variable:</u> FUNCDIR
3207df
3207df
3207df
3207df
3207df
3207df
<u>Variable:</u> FUNCDIRNAME
3207df
3207df
3207df
3207df
3207df
3207df
<u>Variable:</u> FUNCSCRIPT
3207df
3207df
3207df
3207df
3207df
3207df
<u>Variable:</u> FUNCCONFIG
3207df
3207df
3207df
3207df
3207df
3207df
<u>Variable:</u> ACTIONNAM
3207df
3207df
3207df

Define action name.

3207df

3207df

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

3207df
specific function.
3207df

3207df

Action name names aare passed as second argument in

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

3207df

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

3207df
immediatly ends its execution.
3207df

3207df
3207df
3207df
<u>Variable:</u> ACTIONVAL
3207df
3207df
3207df

Define action value.

3207df

3207df

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

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

3207df
3207df
3207df
<u>Variable:</u> REGEX
3207df
3207df
3207df

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

3207df
to process.
3207df

3207df

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

3207df
files.
3207df

3207df

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

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

3207df
3207df
3207df
<u>Variable:</u> ARGUMENTS
3207df
3207df
3207df

Define optional arguments.

3207df

3207df

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

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

3207df

Optional arguments are parsed using getopt command through

3207df
the following base construction: 
3207df

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

Optional arguments provide support to command options inside

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

3207df

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

3207df

In order for getopt to parse ARGUMENTS correctly, it

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

3207df

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

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

3207df

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

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

3207df
3207df
3207df
<u>Variable:</u> EDITOR
3207df
3207df
3207df

Default text editor.

3207df

3207df

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

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

3207df

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

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

3207df
    3207df
  • <tt>`/usr/bin/vim'</tt>
  • 3207df
  • <tt>`/usr/bin/emacs'</tt>
  • 3207df
  • <tt>`/usr/bin/nano'</tt>
  • 3207df
    3207df
    3207df

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

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

    3207df
    3207df
    3207df
    3207df

    3.37.3.2 Global functions

    3207df
    3207df

    Function scripts stored directly under

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

    3207df
    3207df
    <u>Function:</u> cli_checkActionArguments
    3207df
    3207df
    3207df

    Validate action value (ACTIONVAL) variable.

    3207df

    3207df

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

    3207df

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

      If another value different from that specified above is passed to

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      3207df
      3207df
      3207df

      Verify file existence.

      3207df

      3207df

      cli_checkFiles receives a FILE absolute path and performs

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

      3207df
      3207df
      <samp>`d'</samp>
      3207df
      <samp>`directory'</samp>
      3207df

      Ends script execution if FILE is not a directory.

      3207df

      3207df

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

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

      3207df
      3207df
      <samp>`f'</samp>
      3207df
      <samp>`regular-file'</samp>
      3207df

      Ends script execution if FILE is not a regular file.

      3207df

      3207df
      <samp>`h'</samp>
      3207df
      <samp>`symbolic-link'</samp>
      3207df

      Ends script execution if FILE is not a symbolic link.

      3207df

      3207df
      <samp>`x'</samp>
      3207df
      <samp>`execution'</samp>
      3207df

      Ends script execution if FILE is not executable.

      3207df

      3207df
      <samp>`fh'</samp>
      3207df

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

      3207df
      symbolic link.
      3207df

      3207df
      <samp>`fd'</samp>
      3207df

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

      3207df
      directory.
      3207df

      3207df
      <samp>`isInWorkingCopy'</samp>
      3207df

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

      3207df

      3207df
      3207df
      3207df

      As default behaviour, if FILE passes all verifications,

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_commitRepoChanges [LOCATION]
      3207df
      3207df
      3207df

      Syncronize changes between repository and working copy.

      3207df

      3207df

      The cli_commitRepoChanges function brings changes from the

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

      3207df

      Previous to commit the working copy changes up to the central

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

      3207df

      If LOCATION argument is not specified, the value of

      3207df
      ACTIONVAL variable is used as reference instead.
      3207df

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

      Figure 3.14: The cli_commitRepoChanges function output.

      3207df
      3207df

      3207df

      Call the cli_commitRepoChanges function before or/and after

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_doParseArguments
      3207df
      3207df
      3207df

      Redefine arguments (ARGUMENTS) global variable using

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_doParseArgumentsReDef $@
      3207df
      3207df
      3207df

      Initialize/reset arguments (ARGUMENTS) global variable using

      3207df
      positional parameters variable ($@) as reference.
      3207df

      3207df

      When we work inside function definitions, positional parameters are

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getArguments
      3207df
      3207df
      3207df

      Initialize function name (FUNCNAM), action name

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

      3207df

      The cli_getArguments function is called from cli.sh

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

      3207df

      Once command-line positional parameters are accesible to

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

      3207df

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

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

      3207df

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

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

      3207df

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

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getFunctions
      3207df
      3207df
      3207df

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

      3207df

      3207df

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

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

      3207df

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

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

      3207df

      Inside each functionality directory, the functionalty itself is

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

      3207df

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

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

      3207df
      function prefix_doSomething {
      3207df
      3207df
          # Do something here...
      3207df
      3207df
      }
      3207df
      3207df

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

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

      3207df

      If the functionality specified in the command-line first argument

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

      3207df

      In order to keep visual consistency among function scripts, please

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

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

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

      3207df

      3207df

      The cli_getCountryCodes function outputs a list with country

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getCountryName [FILTER]
      3207df
      3207df
      3207df

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

      3207df

      3207df

      The cli_getCountryName function reads one language locale code

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

      3207df
       
      3207df
      3207df
      <u>Function:</u> cli_getCurrentLocale
      3207df
      3207df
      3207df

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

      3207df

      3207df

      The cli_getCurrentLocale function uses LANG environment

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

      3207df

      The current locale information, returned by

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

      3207df

      Locale precedence selection is quite important in order to define the

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

      3207df

      Use cli_getCurrentLocale function to know what current locale

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getFilesList [LOCATION]
      3207df
      3207df
      3207df

      Output list of files to process.

      3207df

      3207df

      The cli_getFilesList function uses LOCATION variable as

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

      3207df

      If LOCATION is not specified when cli_getFilesList

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

      3207df

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

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

      3207df

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

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

      3207df

      As result, the cli_getFilesList re-defines the value of

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

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

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

      3207df

      3207df

      cli_getLangCodes function outputs a list of language codes as

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getLangName [FILTER]
      3207df
      3207df
      3207df

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

      3207df

      3207df

      cli_getLangName function reads one language locale code in the

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getLocales
      3207df
      3207df
      3207df

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

      3207df

      3207df

      Occasionally, you use cli_getLocales function to add locale

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getRepoName NAME TYPE
      3207df
      3207df
      3207df

      Sanitate file names.

      3207df

      3207df

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

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

      3207df
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      3207df
      3207df

      The NAME variable contains the file name or directory name you

      3207df
      want to sanitate.
      3207df

      3207df

      The TYPE variable specifies what type of sanitation you want to

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

      3207df
      3207df
      <samp>`d'</samp>
      3207df
      <samp>`directory'</samp>
      3207df

      Sanitate directory NAMEs.

      3207df

      3207df
      <samp>`f'</samp>
      3207df
      <samp>`regular-file'</samp>
      3207df

      Sanitate regular file NAMEs.

      3207df

      3207df
      3207df
      3207df

      Use cli_getRepoName function to sanitate file names and

      3207df
      directory names before their utilization. 
      3207df

      3207df

      Use cli_getRepoName when you need to change file name

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

      3207df

      When we change file name convenctions inside cli_getRepoName

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getRepoStatus [LOCATION]
      3207df
      3207df
      3207df

      Request repository status.

      3207df

      3207df

      This function requests the status of a LOCATION inside the

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

      3207df

      Use this function to perform verifications based a repository

      3207df
      LOCATION status.
      3207df

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getTemporalFile NAME
      3207df
      3207df
      3207df

      Output absolute path to temporal file NAME.

      3207df

      3207df

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

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

      3207df
      cli_getTemporalFile $FILE
      3207df
      3207df

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_getThemeName
      3207df
      3207df
      3207df

      Output theme name.

      3207df

      3207df

      In order for cli_getThemeName function to extract theme name

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

      3207df
      3207df
      3207df
      <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
      3207df
      3207df
      3207df

      Define standard output message definition supported by

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

      3207df

      When FORMAT is not specified, cli_printMessage outputs

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

      3207df
      3207df
      <samp>`AsHeadingLine'</samp>
      3207df

      To print heading messages.

      3207df

      ----------------------------------------------------------------------
      3207df
      $MESSAGE
      3207df
      ----------------------------------------------------------------------
      3207df
      3207df
      3207df
      <samp>`AsWarningLine'</samp>
      3207df

      To print warning messages.

      3207df

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

      To print note messages.

      3207df

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

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

      3207df

      Updating        $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsRemovingLine'</samp>
      3207df

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

      3207df

      Removing        $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsCheckingLine'</samp>
      3207df

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

      3207df

      Checking        $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsCreatingLine'</samp>
      3207df

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

      3207df

      Creating        $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsSavedAsLine'</samp>
      3207df

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

      3207df

      Saved as        $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsLinkToLine'</samp>
      3207df

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

      3207df

      Linked to       $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsMovedToLine'</samp>
      3207df

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

      3207df

      Moved to        $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsTranslationLine'</samp>
      3207df

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

      3207df

      Translation     $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsConfigurationLine'</samp>
      3207df

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

      3207df

      Configuration   $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsResponseLine'</samp>
      3207df

      To print response messages on one-column format.

      3207df

      --> $MESSAGE
      3207df
      3207df
      3207df
      <samp>`AsRequestLine'</samp>
      3207df

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

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

      $MESSAGE:
      3207df
      3207df
      3207df
      <samp>`AsYesOrNoRequestLine'</samp>
      3207df

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

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

      3207df
      $MESSAGE [y/N]:
      3207df
      3207df

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

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

      3207df
      $MESSAGE [s/N]:
      3207df
      3207df

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

      3207df
      <samp>`sí'</samp> word.
      3207df

      3207df

      Definition of which confirmation word to use is set on translation

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

      3207df
      3207df
      <samp>`AsToKnowMoreLine'</samp>
      3207df

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

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

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

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

      3207df
      script termination. 
      3207df

      3207df
      3207df
      <samp>`AsRegularLine'</samp>
      3207df

      To standardize regular messages on one-column format.

      3207df

      3207df

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

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

      3207df
      3207df
      3207df

      Use cli_printMessage function whenever you need to output

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

      3207df
      Info

      Tip

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

      3207df

      trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
      3207df
      3207df
      3207df
      3207df
      3207df
      3207df

      3.37.3.3 Specific functions

      3207df
      3207df

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

      3207df
      available for you to use:
      3207df

      63f275
      3207df
      3.38 trunk/Scripts/Bash/Functions/Html  
      3207df
      3207df
      3.39 trunk/Scripts/Bash/Functions/Locale  
      3207df
      3207df
      3.40 trunk/Scripts/Bash/Functions/Manual  
      3207df
      3207df
      3.41 trunk/Scripts/Bash/Functions/Path  
      3207df
      3207df
      3.42 trunk/Scripts/Bash/Functions/Render  
      3207df
      3207df
      3.43 trunk/Scripts/Bash/Functions/Render/Config  
      3207df
      3207df
      3.44 trunk/Scripts/Bash/Functions/Shell  
      3207df
      3207df
      3.45 trunk/Scripts/Bash/Functions/Svg  
      6414c4
      3207df
      3.46 trunk/Scripts/Bash/Functions/Verify  
      3207df
      3207df
      3207df
      3207df
      3207df
      3207df

      3.37.4 See also

      3207df
      3207df
      3207df
      3.36 trunk/Scripts/Bash  
      63f275
      3207df
      3.47 trunk/Scripts/Bash/Locale  
      63f275
      63f275
      4c79b5
      5fb024
      4c79b5
      3207df
      [ < ]
      3207df
      [ > ]
      4c79b5
         
      4c79b5
      [ << ]
      01b527
      [ Up ]
      3207df
      [ >> ]
      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>