Blame Manual/repository-html/repository_54.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>
b9dbd3
<title>CentOS Artwork Repository: 2.52 The trunk/Scripts/Bash/Cli/Functions Directory</title>
ee1f37
b9dbd3
<meta name="description" content="CentOS Artwork Repository: 2.52 The trunk/Scripts/Bash/Cli/Functions Directory">
b9dbd3
<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
b9dbd3
[ < ]
b9dbd3
[ > ]
ee1f37
   
b9dbd3
[ << ]
b9dbd3
[ Up ]
b9dbd3
[ >> ]
ee1f37
   
ee1f37
   
ee1f37
   
ee1f37
   
56a476
[Top]
56a476
[Contents]
b130a0
[Index]
56a476
[ ? ]
ee1f37
b9dbd3
b9dbd3
b9dbd3

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

ee1f37
ee1f37
b9dbd3
b9dbd3

2.52.1 Goals

ee1f37
b9dbd3

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

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

ee1f37
b9dbd3
b9dbd3

2.52.2 Description

ee1f37
b9dbd3

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

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

b9dbd3

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

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

b9dbd3

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

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

b9dbd3

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

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

b9dbd3
Info

Tip

Join CentOS developers mailing list

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

ee1f37
b9dbd3

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

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

b9dbd3

OK, let's begin with our functionality example.

b9dbd3

b9dbd3

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

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

b9dbd3

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

b9dbd3

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

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

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

b9dbd3

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

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

b9dbd3

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

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

b9dbd3

In our greet function example, top commentary for

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

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

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

b9dbd3
function definition would look like the following:
b9dbd3

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

The first definition inside greet function, are global

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

b9dbd3

Later, we call greet_getActions function to define the

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

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

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

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

b9dbd3

The greet function definition makes available two valid

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

b9dbd3

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

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

b9dbd3

The greet_doHello and greet_doBye function definitions

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

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

The greet_doHello function definition is stored in

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

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

The greet_doBye function definition is stored in the

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

b9dbd3

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

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

b9dbd3

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

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

b9dbd3

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

b9dbd3
change it to have a little fun.
b9dbd3

b9dbd3

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

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

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

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

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

b9dbd3

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

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

b9dbd3
centos-art locale --edit
b9dbd3
b9dbd3
Warning

Warning

To translate output messages in different languages,

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

b9dbd3
b9dbd3

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

b9dbd3

b9dbd3

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

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

b9dbd3

The greet function described in this section may serve you as

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

b9dbd3

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

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

ee1f37
b9dbd3
b9dbd3

2.52.3 Usage

b9dbd3
b9dbd3
b9dbd3
b9dbd3

2.52.3.1 Global variables

b9dbd3
b9dbd3

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

b9dbd3
available for you to use inside specific functions:
b9dbd3

b9dbd3
b9dbd3
<u>Variable:</u> TEXTDOMAIN
b9dbd3
b9dbd3
b9dbd3

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

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

b9dbd3
b9dbd3
b9dbd3
<u>Variable:</u> TEXTDOMAINDIR
b9dbd3
b9dbd3
b9dbd3

Default directory used to retrieve translated messages. This value is

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

b9dbd3
b9dbd3
b9dbd3
<u>Variable:</u> FUNCNAM
b9dbd3
b9dbd3
b9dbd3

Define function name.

b9dbd3

b9dbd3

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

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

b9dbd3

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

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

b9dbd3

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

b9dbd3
immediatly ends its execution.
b9dbd3

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

Define action name.

b9dbd3

b9dbd3

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

b9dbd3
specific function.
b9dbd3

b9dbd3

Action name names aare passed as second argument in

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

b9dbd3

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

b9dbd3
immediatly ends its execution.
b9dbd3

b9dbd3
b9dbd3
b9dbd3
<u>Variable:</u> ACTIONVAL
b9dbd3
b9dbd3
b9dbd3

Define action value.

b9dbd3

b9dbd3

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

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

b9dbd3
b9dbd3
b9dbd3
<u>Variable:</u> REGEX
b9dbd3
b9dbd3
b9dbd3

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

b9dbd3
to process.
b9dbd3

b9dbd3

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

b9dbd3
files.
b9dbd3

b9dbd3

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

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

b9dbd3
b9dbd3
b9dbd3
<u>Variable:</u> ARGUMENTS
b9dbd3
b9dbd3
b9dbd3

Define optional arguments.

b9dbd3

b9dbd3

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

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

b9dbd3

Optional arguments are parsed using getopt command through

b9dbd3
the following base construction: 
b9dbd3

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

Optional arguments provide support to command options inside

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

b9dbd3

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

b9dbd3

In order for getopt to parse ARGUMENTS correctly, it

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

b9dbd3

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

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

b9dbd3

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

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

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

Default text editor.

b9dbd3

b9dbd3

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

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

b9dbd3

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

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

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

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

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

    b9dbd3
    b9dbd3
    b9dbd3
    b9dbd3

    2.52.3.2 Global functions

    b9dbd3
    b9dbd3

    Function scripts stored directly under

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

    b9dbd3
    b9dbd3
    <u>Function:</u> cli_checkActionArguments
    b9dbd3
    b9dbd3
    b9dbd3

    Validate action value (ACTIONVAL) variable.

    b9dbd3

    b9dbd3

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

    b9dbd3

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

      If another value different from that specified above is passed to

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

      ee1f37
      b9dbd3
      b9dbd3
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      b9dbd3
      b9dbd3
      b9dbd3

      Verify file existence.

      b9dbd3

      b9dbd3

      cli_checkFiles receives a FILE absolute path and performs

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

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

      Ends script execution if FILE is not a directory.

      b9dbd3

      b9dbd3

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

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

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

      Ends script execution if FILE is not a regular file.

      b9dbd3

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

      Ends script execution if FILE is not a symbolic link.

      b9dbd3

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

      Ends script execution if FILE is not executable.

      b9dbd3

      b9dbd3
      <samp>`fh'</samp>
      b9dbd3

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

      b9dbd3
      symbolic link.
      b9dbd3

      b9dbd3
      <samp>`fd'</samp>
      b9dbd3

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

      b9dbd3
      directory.
      b9dbd3

      b9dbd3
      <samp>`isInWorkingCopy'</samp>
      b9dbd3

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

      b9dbd3

      b9dbd3
      b9dbd3
      b9dbd3

      As default behaviour, if FILE passes all verifications,

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

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

      Syncronize changes between repository and working copy.

      b9dbd3

      b9dbd3

      The cli_commitRepoChanges function brings changes from the

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

      b9dbd3

      Previous to commit the working copy changes up to the central

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

      b9dbd3

      If LOCATION argument is not specified, the value of

      b9dbd3
      ACTIONVAL variable is used as reference instead.
      b9dbd3

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

      Figure 2.3: The cli_commitRepoChanges function output.

      b9dbd3
      b9dbd3

      b9dbd3

      Call the cli_commitRepoChanges function before or/and after

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

      b9dbd3
      b9dbd3
      b9dbd3
      <u>Function:</u> cli_doParseArguments
      b9dbd3
      b9dbd3
      b9dbd3

      Redefine arguments (ARGUMENTS) global variable using

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

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

      Initialize/reset arguments (ARGUMENTS) global variable using

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

      b9dbd3

      When we work inside function definitions, positional parameters are

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

      b9dbd3
      b9dbd3
      b9dbd3
      <u>Function:</u> cli_getArguments
      b9dbd3
      b9dbd3
      b9dbd3

      Initialize function name (FUNCNAM), action name

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

      b9dbd3

      The cli_getArguments function is called from cli.sh

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

      b9dbd3

      Once command-line positional parameters are accesible to

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3
      b9dbd3
      b9dbd3
      <u>Function:</u> cli_getFunctions
      b9dbd3
      b9dbd3
      b9dbd3

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

      b9dbd3

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

      Inside each functionality directory, the functionalty itself is

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

      b9dbd3

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

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

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

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

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

      b9dbd3

      If the functionality specified in the command-line first argument

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

      b9dbd3

      In order to keep visual consistency among function scripts, please

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

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

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

      b9dbd3

      b9dbd3

      The cli_getCountryCodes function outputs a list with country

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

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

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

      b9dbd3

      b9dbd3

      The cli_getCountryName function reads one language locale code

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

      b9dbd3
       
      b9dbd3
      b9dbd3
      <u>Function:</u> cli_getCurrentLocale
      b9dbd3
      b9dbd3
      b9dbd3

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

      b9dbd3

      b9dbd3

      The cli_getCurrentLocale function uses LANG environment

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

      b9dbd3

      The current locale information, returned by

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

      b9dbd3

      Locale precedence selection is quite important in order to define the

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

      b9dbd3

      Use cli_getCurrentLocale function to know what current locale

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

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

      Output list of files to process.

      b9dbd3

      b9dbd3

      The cli_getFilesList function uses LOCATION variable as

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

      b9dbd3

      If LOCATION is not specified when cli_getFilesList

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

      As result, the cli_getFilesList re-defines the value of

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

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

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

      b9dbd3

      b9dbd3

      cli_getLangCodes function outputs a list of language codes as

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

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

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

      b9dbd3

      b9dbd3

      cli_getLangName function reads one language locale code in the

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

      b9dbd3
      b9dbd3
      b9dbd3
      <u>Function:</u> cli_getLocales
      b9dbd3
      b9dbd3
      b9dbd3

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

      b9dbd3

      b9dbd3

      Occasionally, you use cli_getLocales function to add locale

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

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

      Sanitate file names.

      b9dbd3

      b9dbd3

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

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

      b9dbd3
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      b9dbd3
      b9dbd3

      The NAME variable contains the file name or directory name you

      b9dbd3
      want to sanitate.
      b9dbd3

      b9dbd3

      The TYPE variable specifies what type of sanitation you want to

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

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

      Sanitate directory NAMEs.

      b9dbd3

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

      Sanitate regular file NAMEs.

      b9dbd3

      b9dbd3
      b9dbd3
      b9dbd3

      Use cli_getRepoName function to sanitate file names and

      b9dbd3
      directory names before their utilization. 
      b9dbd3

      b9dbd3

      Use cli_getRepoName when you need to change file name

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

      b9dbd3

      When we change file name convenctions inside cli_getRepoName

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

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

      Request repository status.

      b9dbd3

      b9dbd3

      This function requests the status of a LOCATION inside the

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

      b9dbd3

      Use this function to perform verifications based a repository

      b9dbd3
      LOCATION status.
      b9dbd3

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

      Output absolute path to temporal file NAME.

      b9dbd3

      b9dbd3

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

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

      b9dbd3
      cli_getTemporalFile $FILE
      b9dbd3
      b9dbd3

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      b9dbd3
      b9dbd3
      b9dbd3
      <u>Function:</u> cli_getThemeName
      b9dbd3
      b9dbd3
      b9dbd3

      Output theme name.

      b9dbd3

      b9dbd3

      In order for cli_getThemeName function to extract theme name

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

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

      Define standard output message definition supported by

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

      b9dbd3

      When FORMAT is not specified, cli_printMessage outputs

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

      b9dbd3
      b9dbd3
      <samp>`AsHeadingLine'</samp>
      b9dbd3

      To print heading messages.

      b9dbd3

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

      To print warning messages.

      b9dbd3

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

      To print note messages.

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

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

      b9dbd3

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

      To print response messages on one-column format.

      b9dbd3

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

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

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

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

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

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

      b9dbd3
      $MESSAGE [y/N]:
      b9dbd3
      b9dbd3

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

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

      b9dbd3
      $MESSAGE [s/N]:
      b9dbd3
      b9dbd3

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

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

      b9dbd3

      Definition of which confirmation word to use is set on translation

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

      b9dbd3
      b9dbd3
      <samp>`AsToKnowMoreLine'</samp>
      b9dbd3

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

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

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

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

      b9dbd3
      script termination. 
      b9dbd3

      b9dbd3
      b9dbd3
      <samp>`AsRegularLine'</samp>
      b9dbd3

      To standardize regular messages on one-column format.

      b9dbd3

      b9dbd3

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

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

      b9dbd3
      b9dbd3
      b9dbd3

      Use cli_printMessage function whenever you need to output

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

      b9dbd3
      Info

      Tip

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

      b9dbd3

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

      2.52.3.3 Specific functions

      b9dbd3
      b9dbd3

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

      b9dbd3
      available for you to use:
      b9dbd3

      b9dbd3
      b9dbd3
      b9dbd3
      b9dbd3

      2.52.4 See also

      ee1f37
      b9dbd3
      b9dbd3
      2.50 The <tt>`trunk/Scripts/Bash'</tt> Directory  
      b9dbd3
      b9dbd3
      ee1f37
      ee1f37
      ee1f37
      b9dbd3
      [ < ]
      b9dbd3
      [ > ]
      ee1f37
         
      b9dbd3
      [ << ]
      b9dbd3
      [ Up ]
      b9dbd3
      [ >> ]
      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>