Blame Identity/Manual/repository-xhtml/repository_70.xhtml

c8f7b7
728c6d
728c6d
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
728c6d
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
728c6d
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
f66721
<head>
f66721
a6f1b3
    <title>CentOS Artwork Repository: 2.63 The trunk/Scripts/Functions Directory</title>
c8f7b7
c8f7b7
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
a6f1b3
    <meta name="description" content="CentOS Artwork Repository: 2.63 The trunk/Scripts/Functions Directory" />
a6f1b3
    <meta name="keywords" content="CentOS Artwork Repository: 2.63 The trunk/Scripts/Functions Directory" />
728c6d
    <meta name="resource-type" content="document" />
728c6d
    <meta name="distribution" content="global" />
728c6d
    <meta name="generator" content="texi2html 1.76" />
728c6d
    <meta name="copyright" content="2009-2011 Alain Reguera Delgado" />
f66721
c8f7b7
    <link href="/home/centos/artwork/trunk/Identity/Manual/repository.css" rel="stylesheet" type="text/css" media="screen projection" />
f66721
f66721
</head>
f66721
728c6d
<body>
f66721
728c6d
728c6d
728c6d
728c6d
728c6d
    
728c6d
728c6d
        
c8f7b7
a6f1b3
f66721
c8f7b7
[ < ]
ed9de5
[ > ]
f66721
   
c8f7b7
[ << ]
c8f7b7
[ Up ]
a6f1b3
[ >> ]
f66721
   
f66721
   
f66721
   
f66721
   
c8f7b7
[Top]
c8f7b7
[Contents]
a6f1b3
[Index]
c8f7b7
[ ? ]
f66721
a6f1b3
ed9de5
a6f1b3

2.63 The <tt>`trunk/Scripts/Functions'</tt> Directory

ed9de5
728c6d

ed9de5
ed9de5

2.63.1 Goals

ed9de5
a6f1b3

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

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

728c6d

ed9de5
ed9de5

2.63.2 Description

ed9de5
a6f1b3

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

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

a6f1b3

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

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

a6f1b3

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

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

a6f1b3

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

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

a6f1b3
Idea

Tip

Join CentOS developers mailing list

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

a6f1b3
a6f1b3

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

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

a6f1b3

OK, let's begin with our functionality example.

a6f1b3

a6f1b3

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

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

a6f1b3

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

a6f1b3

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

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

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

a6f1b3

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

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

a6f1b3

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

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

a6f1b3

In our greet function example, top commentary for

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

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

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

a6f1b3
function definition would look like the following:
a6f1b3

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

The first definition inside greet function, are global

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

a6f1b3

Later, we call greet_getActions function to define the

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

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

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

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

a6f1b3

The greet function definition makes available two valid

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

a6f1b3

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

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

a6f1b3

The greet_doHello and greet_doBye function definitions

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

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

The greet_doHello function definition is stored in

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

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

The greet_doBye function definition is stored in the

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

a6f1b3

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

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

a6f1b3

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

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

a6f1b3

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

a6f1b3
change it to have a little fun.
a6f1b3

a6f1b3

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

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

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

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

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

a6f1b3

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

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

a6f1b3
centos-art locale --edit
a6f1b3
a6f1b3
Warning

Warning

To translate output messages in different languages,

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

a6f1b3
a6f1b3

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

a6f1b3

a6f1b3

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

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

a6f1b3

The greet function described in this section may serve you as

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

a6f1b3

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

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

728c6d

ed9de5
ed9de5

2.63.3 Usage

ed9de5
a6f1b3

a6f1b3
a6f1b3

2.63.3.1 Global variables

a6f1b3
a6f1b3

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

a6f1b3
available for you to use inside specific functions:
a6f1b3

a6f1b3
a6f1b3
Variable: TEXTDOMAIN
a6f1b3
a6f1b3
a6f1b3

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

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

a6f1b3
a6f1b3
a6f1b3
Variable: TEXTDOMAINDIR
a6f1b3
a6f1b3
a6f1b3

Default directory used to retrieve translated messages. This value is

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

a6f1b3
a6f1b3
a6f1b3
Variable: FUNCNAM
a6f1b3
a6f1b3
a6f1b3

Define function name.

a6f1b3

a6f1b3

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

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

a6f1b3

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

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

a6f1b3

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

a6f1b3
immediatly ends its execution.
a6f1b3

a6f1b3
a6f1b3
a6f1b3
Variable: FUNCDIR
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
Variable: FUNCDIRNAME
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
Variable: FUNCSCRIPT
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
Variable: FUNCCONFIG
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
a6f1b3
Variable: ACTIONNAM
a6f1b3
a6f1b3
a6f1b3

Define action name.

a6f1b3

a6f1b3

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

a6f1b3
specific function.
a6f1b3

a6f1b3

Action name names aare passed as second argument in

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

a6f1b3

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

a6f1b3
immediatly ends its execution.
a6f1b3

a6f1b3
a6f1b3
a6f1b3
Variable: ACTIONVAL
a6f1b3
a6f1b3
a6f1b3

Define action value.

a6f1b3

a6f1b3

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

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

a6f1b3
a6f1b3
a6f1b3
Variable: REGEX
a6f1b3
a6f1b3
a6f1b3

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

a6f1b3
to process.
a6f1b3

a6f1b3

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

a6f1b3
files.
a6f1b3

a6f1b3

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

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

a6f1b3
a6f1b3
a6f1b3
Variable: ARGUMENTS
a6f1b3
a6f1b3
a6f1b3

Define optional arguments.

a6f1b3

a6f1b3

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

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

a6f1b3

Optional arguments are parsed using getopt command through

a6f1b3
the following base construction: 
a6f1b3

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

Optional arguments provide support to command options inside

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

a6f1b3

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

a6f1b3

In order for getopt to parse ARGUMENTS correctly, it

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

a6f1b3

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

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

a6f1b3

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

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

a6f1b3
a6f1b3
a6f1b3
Variable: EDITOR
a6f1b3
a6f1b3
a6f1b3

Default text editor.

a6f1b3

a6f1b3

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

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

a6f1b3

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

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

ed9de5
    a6f1b3
  • <tt>`/usr/bin/vim'</tt>
  • a6f1b3
  • <tt>`/usr/bin/emacs'</tt>
  • a6f1b3
  • <tt>`/usr/bin/nano'</tt>
  • ed9de5
    ed9de5
    a6f1b3

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

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

    a6f1b3
    728c6d

    a6f1b3
    a6f1b3

    2.63.3.2 Global functions

    a6f1b3
    a6f1b3

    Function scripts stored directly under

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

    a6f1b3
    a6f1b3
    Function: cli_checkActionArguments
    a6f1b3
    a6f1b3
    a6f1b3

    Validate action value (ACTIONVAL) variable.

    a6f1b3

    a6f1b3

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

    a6f1b3

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

      If another value different from that specified above is passed to

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_checkFiles FILE [TYPE]
      a6f1b3
      a6f1b3
      a6f1b3

      Verify file existence.

      a6f1b3

      a6f1b3

      cli_checkFiles receives a FILE absolute path and performs

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

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

      Ends script execution if FILE is not a directory.

      a6f1b3

      a6f1b3

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

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

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

      Ends script execution if FILE is not a regular file.

      a6f1b3

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

      Ends script execution if FILE is not a symbolic link.

      a6f1b3

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

      Ends script execution if FILE is not executable.

      a6f1b3

      a6f1b3
      <samp>`fh'</samp>
      a6f1b3

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

      a6f1b3
      symbolic link.
      a6f1b3

      a6f1b3
      <samp>`fd'</samp>
      a6f1b3

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

      a6f1b3
      directory.
      a6f1b3

      a6f1b3
      <samp>`isInWorkingCopy'</samp>
      a6f1b3

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

      a6f1b3

      a6f1b3
      a6f1b3
      a6f1b3

      As default behaviour, if FILE passes all verifications,

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_commitRepoChanges [LOCATION]
      a6f1b3
      a6f1b3
      a6f1b3

      Syncronize changes between repository and working copy.

      a6f1b3

      a6f1b3

      The cli_commitRepoChanges function brings changes from the

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

      a6f1b3

      Previous to commit the working copy changes up to the central

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

      a6f1b3

      If LOCATION argument is not specified, the value of

      a6f1b3
      ACTIONVAL variable is used as reference instead.
      a6f1b3

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

      Figure 2.3: The cli_commitRepoChanges function output.

      a6f1b3
      a6f1b3

      a6f1b3

      Call the cli_commitRepoChanges function before or/and after

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_doParseArguments
      a6f1b3
      a6f1b3
      a6f1b3

      Redefine arguments (ARGUMENTS) global variable using

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_doParseArgumentsReDef $@
      a6f1b3
      a6f1b3
      a6f1b3

      Initialize/reset arguments (ARGUMENTS) global variable using

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

      a6f1b3

      When we work inside function definitions, positional parameters are

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getArguments
      a6f1b3
      a6f1b3
      a6f1b3

      Initialize function name (FUNCNAM), action name

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

      a6f1b3

      The cli_getArguments function is called from cli.sh

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

      a6f1b3

      Once command-line positional parameters are accesible to

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getFunctions
      a6f1b3
      a6f1b3
      a6f1b3

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

      a6f1b3

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

      Inside each functionality directory, the functionalty itself is

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

      a6f1b3

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

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

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

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

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

      a6f1b3

      If the functionality specified in the command-line first argument

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

      a6f1b3

      In order to keep visual consistency among function scripts, please

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

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

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

      a6f1b3

      a6f1b3

      The cli_getCountryCodes function outputs a list with country

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getCountryName [FILTER]
      a6f1b3
      a6f1b3
      a6f1b3

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

      a6f1b3

      a6f1b3

      The cli_getCountryName function reads one language locale code

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

      a6f1b3
       
      a6f1b3
      a6f1b3
      Function: cli_getCurrentLocale
      a6f1b3
      a6f1b3
      a6f1b3

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

      a6f1b3

      a6f1b3

      The cli_getCurrentLocale function uses LANG environment

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

      a6f1b3

      The current locale information, returned by

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

      a6f1b3

      Locale precedence selection is quite important in order to define the

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

      a6f1b3

      Use cli_getCurrentLocale function to know what current locale

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getFilesList [LOCATION]
      a6f1b3
      a6f1b3
      a6f1b3

      Output list of files to process.

      a6f1b3

      a6f1b3

      The cli_getFilesList function uses LOCATION variable as

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

      a6f1b3

      If LOCATION is not specified when cli_getFilesList

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

      As result, the cli_getFilesList re-defines the value of

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

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

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

      a6f1b3

      a6f1b3

      cli_getLangCodes function outputs a list of language codes as

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getLangName [FILTER]
      a6f1b3
      a6f1b3
      a6f1b3

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

      a6f1b3

      a6f1b3

      cli_getLangName function reads one language locale code in the

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getLocales
      a6f1b3
      a6f1b3
      a6f1b3

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

      a6f1b3

      a6f1b3

      Occasionally, you use cli_getLocales function to add locale

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getRepoName NAME TYPE
      a6f1b3
      a6f1b3
      a6f1b3

      Sanitate file names.

      a6f1b3

      a6f1b3

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

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

      a6f1b3
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      a6f1b3
      a6f1b3

      The NAME variable contains the file name or directory name you

      a6f1b3
      want to sanitate.
      a6f1b3

      a6f1b3

      The TYPE variable specifies what type of sanitation you want to

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

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

      Sanitate directory NAMEs.

      a6f1b3

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

      Sanitate regular file NAMEs.

      a6f1b3

      a6f1b3
      a6f1b3
      a6f1b3

      Use cli_getRepoName function to sanitate file names and

      a6f1b3
      directory names before their utilization. 
      a6f1b3

      a6f1b3

      Use cli_getRepoName when you need to change file name

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

      a6f1b3

      When we change file name convenctions inside cli_getRepoName

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getRepoStatus [LOCATION]
      a6f1b3
      a6f1b3
      a6f1b3

      Request repository status.

      a6f1b3

      a6f1b3

      This function requests the status of a LOCATION inside the

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

      a6f1b3

      Use this function to perform verifications based a repository

      a6f1b3
      LOCATION status.
      a6f1b3

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getTemporalFile NAME
      a6f1b3
      a6f1b3
      a6f1b3

      Output absolute path to temporal file NAME.

      a6f1b3

      a6f1b3

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

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

      a6f1b3
      cli_getTemporalFile $FILE
      a6f1b3
      a6f1b3

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_getThemeName
      a6f1b3
      a6f1b3
      a6f1b3

      Output theme name.

      a6f1b3

      a6f1b3

      In order for cli_getThemeName function to extract theme name

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

      a6f1b3
      a6f1b3
      a6f1b3
      Function: cli_printMessage MESSAGE [FORMAT]
      a6f1b3
      a6f1b3
      a6f1b3

      Define standard output message definition supported by

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

      a6f1b3

      When FORMAT is not specified, cli_printMessage outputs

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

      a6f1b3
      a6f1b3
      <samp>`AsHeadingLine'</samp>
      a6f1b3

      To print heading messages.

      a6f1b3

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

      To print warning messages.

      a6f1b3

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

      To print note messages.

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

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

      a6f1b3

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

      To print response messages on one-column format.

      a6f1b3

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

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

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

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

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

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

      a6f1b3
      $MESSAGE [y/N]:
      a6f1b3
      a6f1b3

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

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

      a6f1b3
      $MESSAGE [s/N]:
      a6f1b3
      a6f1b3

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

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

      a6f1b3

      Definition of which confirmation word to use is set on translation

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

      a6f1b3
      a6f1b3
      <samp>`AsToKnowMoreLine'</samp>
      a6f1b3

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

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

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

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

      a6f1b3
      script termination. 
      a6f1b3

      a6f1b3
      a6f1b3
      <samp>`AsRegularLine'</samp>
      a6f1b3

      To standardize regular messages on one-column format.

      a6f1b3

      a6f1b3

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

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

      a6f1b3
      a6f1b3
      a6f1b3

      Use cli_printMessage function whenever you need to output

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

      a6f1b3
      Idea

      Tip

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

      a6f1b3

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

      a6f1b3
      a6f1b3

      2.63.3.3 Specific functions

      a6f1b3
      a6f1b3

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

      a6f1b3
      available for you to use:
      a6f1b3

      a6f1b3
      a6f1b3

      a6f1b3
      ed9de5

      2.63.4 See also

      632e8b
      a6f1b3
      a6f1b3
      2.62 The <tt>`trunk/Scripts'</tt> Directory  
      a6f1b3
      a6f1b3
      f66721
      728c6d

      f66721
      a6f1b3
      [ < ]
      a6f1b3
      [ > ]
      f66721
         
      c8f7b7
      [ << ]
      ed9de5
      [ Up ]
      a6f1b3
      [ >> ]
      f66721
      f66721
      728c6d
                  

      728c6d
      728c6d
              
      728c6d
      728c6d
          
      728c6d
      728c6d
          

      728c6d
      728c6d
      728c6d
      f66721
      </body>
      728c6d
      f66721
      </html>