Blame Manuals/Repository/repository-html/repository_51.html

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

3.48 trunk/Scripts/Bash/Functions

008ee0
54b5a5
4a9d2a
63f275

3.48.1 Goals

54b5a5
4a9d2a

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

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

4a9d2a
4a9d2a
4a9d2a

3.48.2 Description

4a9d2a
4a9d2a

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

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

4a9d2a

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

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

4a9d2a

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

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

4a9d2a

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

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

4a9d2a
Info

Tip

Join CentOS developers mailing list

4a9d2a
centos-art@centos.org to share your ideas.
4a9d2a

4a9d2a
4a9d2a

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

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

4a9d2a

OK, let's begin with our functionality example.

4a9d2a

4a9d2a

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

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

4a9d2a

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

4a9d2a

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

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

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

4a9d2a

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

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

4a9d2a

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

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

4a9d2a

In our greet function example, top commentary for

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

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

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

4a9d2a
function definition would look like the following:
4a9d2a

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

The first definition inside greet function, are global

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

4a9d2a

Later, we call greet_getActions function to define the

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

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

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

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

4a9d2a

The greet function definition makes available two valid

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

4a9d2a

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

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

4a9d2a

The greet_doHello and greet_doBye function definitions

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

4a9d2a
function greet_doHello {
4a9d2a
4a9d2a
    cli_printMessage "`gettext "Hello"` $ACTIONVAL"
4a9d2a
4a9d2a
}
4a9d2a
4a9d2a

The greet_doHello function definition is stored in

4a9d2a
<tt>`greet_doHello.sh'</tt> function script. 
4a9d2a

4a9d2a
function greet_doBye {
4a9d2a
4a9d2a
    cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
4a9d2a
4a9d2a
}
4a9d2a
4a9d2a

The greet_doBye function definition is stored in the

4a9d2a
<tt>`greet_doBye.sh'</tt> function script. 
4a9d2a

4a9d2a

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

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

4a9d2a

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

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

4a9d2a

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

4a9d2a
change it to have a little fun.
4a9d2a

4a9d2a

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

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

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

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

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

4a9d2a

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

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

4a9d2a
centos-art locale --edit
4a9d2a
4a9d2a
Warning

Warning

To translate output messages in different languages,

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

4a9d2a
4a9d2a

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

4a9d2a

4a9d2a

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

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

4a9d2a

The greet function described in this section may serve you as

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

4a9d2a

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

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

4a9d2a
4a9d2a
4a9d2a

3.48.3 Usage

4a9d2a
4a9d2a
4a9d2a
4a9d2a

3.48.3.1 Global variables

4a9d2a
4a9d2a

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

4a9d2a
available for you to use inside specific functions:
4a9d2a

4a9d2a
4a9d2a
<u>Variable:</u> TEXTDOMAIN
4a9d2a
4a9d2a
4a9d2a

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

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

4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> TEXTDOMAINDIR
4a9d2a
4a9d2a
4a9d2a

Default directory used to retrieve translated messages. This value is

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

4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> FUNCNAM
4a9d2a
4a9d2a
4a9d2a

Define function name.

4a9d2a

4a9d2a

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

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

4a9d2a

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

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

4a9d2a

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

4a9d2a
immediatly ends its execution.
4a9d2a

4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> FUNCDIR
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> FUNCDIRNAME
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> FUNCSCRIPT
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> FUNCCONFIG
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> ACTIONNAM
4a9d2a
4a9d2a
4a9d2a

Define action name.

4a9d2a

4a9d2a

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

4a9d2a
specific function.
4a9d2a

4a9d2a

Action name names aare passed as second argument in

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

4a9d2a

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

4a9d2a
immediatly ends its execution.
4a9d2a

4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> ACTIONVAL
4a9d2a
4a9d2a
4a9d2a

Define action value.

4a9d2a

4a9d2a

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

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

4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> REGEX
4a9d2a
4a9d2a
4a9d2a

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

4a9d2a
to process.
4a9d2a

4a9d2a

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

4a9d2a
files.
4a9d2a

4a9d2a

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

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

4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> ARGUMENTS
4a9d2a
4a9d2a
4a9d2a

Define optional arguments.

4a9d2a

4a9d2a

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

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

4a9d2a

Optional arguments are parsed using getopt command through

4a9d2a
the following base construction: 
4a9d2a

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

Optional arguments provide support to command options inside

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

4a9d2a

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

4a9d2a

In order for getopt to parse ARGUMENTS correctly, it

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

4a9d2a

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

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

4a9d2a

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

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

4a9d2a
4a9d2a
4a9d2a
<u>Variable:</u> EDITOR
4a9d2a
4a9d2a
4a9d2a

Default text editor.

4a9d2a

4a9d2a

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

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

4a9d2a

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

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

ec5f63
    4a9d2a
  • <tt>`/usr/bin/vim'</tt>
  • 4a9d2a
  • <tt>`/usr/bin/emacs'</tt>
  • 4a9d2a
  • <tt>`/usr/bin/nano'</tt>
  • ec5f63
    ec5f63
    4a9d2a

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

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

    54b5a5
    2c8180
    4a9d2a
    4a9d2a

    3.48.3.2 Global functions

    2c8180
    4a9d2a

    Function scripts stored directly under

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

    4a9d2a
    4a9d2a
    <u>Function:</u> cli_checkActionArguments
    4a9d2a
    4a9d2a
    4a9d2a

    Validate action value (ACTIONVAL) variable.

    4a9d2a

    4a9d2a

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

    4a9d2a

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

      If another value different from that specified above is passed to

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      4a9d2a
      4a9d2a
      4a9d2a

      Verify file existence.

      4a9d2a

      4a9d2a

      cli_checkFiles receives a FILE absolute path and performs

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

      4a9d2a
      4a9d2a
      <samp>`d'</samp>
      4a9d2a
      <samp>`directory'</samp>
      4a9d2a

      Ends script execution if FILE is not a directory.

      4a9d2a

      4a9d2a

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

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

      4a9d2a
      4a9d2a
      <samp>`f'</samp>
      4a9d2a
      <samp>`regular-file'</samp>
      4a9d2a

      Ends script execution if FILE is not a regular file.

      4a9d2a

      4a9d2a
      <samp>`h'</samp>
      4a9d2a
      <samp>`symbolic-link'</samp>
      4a9d2a

      Ends script execution if FILE is not a symbolic link.

      4a9d2a

      4a9d2a
      <samp>`x'</samp>
      4a9d2a
      <samp>`execution'</samp>
      4a9d2a

      Ends script execution if FILE is not executable.

      4a9d2a

      4a9d2a
      <samp>`fh'</samp>
      4a9d2a

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

      4a9d2a
      symbolic link.
      4a9d2a

      4a9d2a
      <samp>`fd'</samp>
      4a9d2a

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

      4a9d2a
      directory.
      4a9d2a

      4a9d2a
      <samp>`isInWorkingCopy'</samp>
      4a9d2a

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

      4a9d2a

      4a9d2a
      4a9d2a
      4a9d2a

      As default behaviour, if FILE passes all verifications,

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_commitRepoChanges [LOCATION]
      4a9d2a
      4a9d2a
      4a9d2a

      Syncronize changes between repository and working copy.

      4a9d2a

      4a9d2a

      The cli_commitRepoChanges function brings changes from the

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

      4a9d2a

      Previous to commit the working copy changes up to the central

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

      4a9d2a

      If LOCATION argument is not specified, the value of

      4a9d2a
      ACTIONVAL variable is used as reference instead.
      4a9d2a

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

      Figure 3.3: The cli_commitRepoChanges function output.

      4a9d2a
      4a9d2a

      4a9d2a

      Call the cli_commitRepoChanges function before or/and after

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_doParseArguments
      4a9d2a
      4a9d2a
      4a9d2a

      Redefine arguments (ARGUMENTS) global variable using

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_doParseArgumentsReDef $@
      4a9d2a
      4a9d2a
      4a9d2a

      Initialize/reset arguments (ARGUMENTS) global variable using

      4a9d2a
      positional parameters variable ($@) as reference.
      4a9d2a

      4a9d2a

      When we work inside function definitions, positional parameters are

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getArguments
      4a9d2a
      4a9d2a
      4a9d2a

      Initialize function name (FUNCNAM), action name

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

      4a9d2a

      The cli_getArguments function is called from cli.sh

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

      4a9d2a

      Once command-line positional parameters are accesible to

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

      4a9d2a

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

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

      4a9d2a

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

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

      4a9d2a

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

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getFunctions
      4a9d2a
      4a9d2a
      4a9d2a

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

      4a9d2a

      4a9d2a

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

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

      4a9d2a

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

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

      4a9d2a

      Inside each functionality directory, the functionalty itself is

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

      4a9d2a

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

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

      4a9d2a
      function prefix_doSomething {
      4a9d2a
      4a9d2a
          # Do something here...
      4a9d2a
      4a9d2a
      }
      4a9d2a
      4a9d2a

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

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

      4a9d2a

      If the functionality specified in the command-line first argument

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

      4a9d2a

      In order to keep visual consistency among function scripts, please

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

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

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

      4a9d2a

      4a9d2a

      The cli_getCountryCodes function outputs a list with country

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getCountryName [FILTER]
      4a9d2a
      4a9d2a
      4a9d2a

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

      4a9d2a

      4a9d2a

      The cli_getCountryName function reads one language locale code

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

      4a9d2a
       
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getCurrentLocale
      4a9d2a
      4a9d2a
      4a9d2a

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

      4a9d2a

      4a9d2a

      The cli_getCurrentLocale function uses LANG environment

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

      4a9d2a

      The current locale information, returned by

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

      4a9d2a

      Locale precedence selection is quite important in order to define the

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

      4a9d2a

      Use cli_getCurrentLocale function to know what current locale

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getFilesList [LOCATION]
      4a9d2a
      4a9d2a
      4a9d2a

      Output list of files to process.

      4a9d2a

      4a9d2a

      The cli_getFilesList function uses LOCATION variable as

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

      4a9d2a

      If LOCATION is not specified when cli_getFilesList

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

      4a9d2a

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

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

      4a9d2a

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

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

      4a9d2a

      As result, the cli_getFilesList re-defines the value of

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

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

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

      4a9d2a

      4a9d2a

      cli_getLangCodes function outputs a list of language codes as

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getLangName [FILTER]
      4a9d2a
      4a9d2a
      4a9d2a

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

      4a9d2a

      4a9d2a

      cli_getLangName function reads one language locale code in the

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getLocales
      4a9d2a
      4a9d2a
      4a9d2a

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

      4a9d2a

      4a9d2a

      Occasionally, you use cli_getLocales function to add locale

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getRepoName NAME TYPE
      4a9d2a
      4a9d2a
      4a9d2a

      Sanitate file names.

      4a9d2a

      4a9d2a

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

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

      4a9d2a
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      4a9d2a
      4a9d2a

      The NAME variable contains the file name or directory name you

      4a9d2a
      want to sanitate.
      4a9d2a

      4a9d2a

      The TYPE variable specifies what type of sanitation you want to

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

      4a9d2a
      4a9d2a
      <samp>`d'</samp>
      4a9d2a
      <samp>`directory'</samp>
      4a9d2a

      Sanitate directory NAMEs.

      4a9d2a

      4a9d2a
      <samp>`f'</samp>
      4a9d2a
      <samp>`regular-file'</samp>
      4a9d2a

      Sanitate regular file NAMEs.

      4a9d2a

      4a9d2a
      4a9d2a
      4a9d2a

      Use cli_getRepoName function to sanitate file names and

      4a9d2a
      directory names before their utilization. 
      4a9d2a

      4a9d2a

      Use cli_getRepoName when you need to change file name

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

      4a9d2a

      When we change file name convenctions inside cli_getRepoName

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getRepoStatus [LOCATION]
      4a9d2a
      4a9d2a
      4a9d2a

      Request repository status.

      4a9d2a

      4a9d2a

      This function requests the status of a LOCATION inside the

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

      4a9d2a

      Use this function to perform verifications based a repository

      4a9d2a
      LOCATION status.
      4a9d2a

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getTemporalFile NAME
      4a9d2a
      4a9d2a
      4a9d2a

      Output absolute path to temporal file NAME.

      4a9d2a

      4a9d2a

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

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

      4a9d2a
      cli_getTemporalFile $FILE
      4a9d2a
      4a9d2a

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_getThemeName
      4a9d2a
      4a9d2a
      4a9d2a

      Output theme name.

      4a9d2a

      4a9d2a

      In order for cli_getThemeName function to extract theme name

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

      4a9d2a
      4a9d2a
      4a9d2a
      <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
      4a9d2a
      4a9d2a
      4a9d2a

      Define standard output message definition supported by

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

      4a9d2a

      When FORMAT is not specified, cli_printMessage outputs

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

      4a9d2a
      4a9d2a
      <samp>`AsHeadingLine'</samp>
      4a9d2a

      To print heading messages.

      4a9d2a

      ----------------------------------------------------------------------
      4a9d2a
      $MESSAGE
      4a9d2a
      ----------------------------------------------------------------------
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsWarningLine'</samp>
      4a9d2a

      To print warning messages.

      4a9d2a

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

      To print note messages.

      4a9d2a

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

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

      4a9d2a

      Updating        $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsRemovingLine'</samp>
      4a9d2a

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

      4a9d2a

      Removing        $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsCheckingLine'</samp>
      4a9d2a

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

      4a9d2a

      Checking        $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsCreatingLine'</samp>
      4a9d2a

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

      4a9d2a

      Creating        $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsSavedAsLine'</samp>
      4a9d2a

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

      4a9d2a

      Saved as        $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsLinkToLine'</samp>
      4a9d2a

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

      4a9d2a

      Linked to       $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsMovedToLine'</samp>
      4a9d2a

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

      4a9d2a

      Moved to        $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsTranslationLine'</samp>
      4a9d2a

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

      4a9d2a

      Translation     $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsConfigurationLine'</samp>
      4a9d2a

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

      4a9d2a

      Configuration   $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsResponseLine'</samp>
      4a9d2a

      To print response messages on one-column format.

      4a9d2a

      --> $MESSAGE
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsRequestLine'</samp>
      4a9d2a

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

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

      $MESSAGE:
      4a9d2a
      4a9d2a
      4a9d2a
      <samp>`AsYesOrNoRequestLine'</samp>
      4a9d2a

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

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

      4a9d2a
      $MESSAGE [y/N]:
      4a9d2a
      4a9d2a

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

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

      4a9d2a
      $MESSAGE [s/N]:
      4a9d2a
      4a9d2a

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

      4a9d2a
      <samp>`sí'</samp> word.
      4a9d2a

      4a9d2a

      Definition of which confirmation word to use is set on translation

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

      4a9d2a
      4a9d2a
      <samp>`AsToKnowMoreLine'</samp>
      4a9d2a

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

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

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

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

      4a9d2a
      script termination. 
      4a9d2a

      4a9d2a
      4a9d2a
      <samp>`AsRegularLine'</samp>
      4a9d2a

      To standardize regular messages on one-column format.

      4a9d2a

      4a9d2a

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

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

      4a9d2a
      4a9d2a
      4a9d2a

      Use cli_printMessage function whenever you need to output

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

      4a9d2a
      Info

      Tip

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

      4a9d2a

      trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
      4a9d2a
      4a9d2a
      4a9d2a
      4a9d2a
      4a9d2a
      4a9d2a

      3.48.3.3 Specific functions

      4a9d2a
      4a9d2a

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

      4a9d2a
      available for you to use:
      4a9d2a

      4a9d2a
      4a9d2a
      3.49 trunk/Scripts/Bash/Functions/Html  
      4a9d2a
      4a9d2a
      3.50 trunk/Scripts/Bash/Functions/Locale  
      4a9d2a
      4a9d2a
      3.51 trunk/Scripts/Bash/Functions/Manual  
      4a9d2a
      4a9d2a
      3.52 trunk/Scripts/Bash/Functions/Path  
      4a9d2a
      4a9d2a
      3.53 trunk/Scripts/Bash/Functions/Render  
      4a9d2a
      4a9d2a
      3.54 trunk/Scripts/Bash/Functions/Render/Config  
      4a9d2a
      4a9d2a
      3.55 trunk/Scripts/Bash/Functions/Shell  
      4a9d2a
      4a9d2a
      3.56 trunk/Scripts/Bash/Functions/Svg  
      4a9d2a
      4a9d2a
      3.57 trunk/Scripts/Bash/Functions/Verify  
      4a9d2a
      4a9d2a
      2c8180
      54b5a5
      4a9d2a
      4c79b5

      3.48.4 See also

      4c79b5
      4a9d2a
      4a9d2a
      3.47 trunk/Scripts/Bash  
      4a9d2a
      4a9d2a
      3.58 trunk/Scripts/Bash/Locale  
      4a9d2a
      4a9d2a
      4c79b5
      4c79b5
      4c79b5
      4a9d2a
      [ < ]
      4a9d2a
      [ > ]
      4c79b5
         
      4c79b5
      [ << ]
      4a9d2a
      [ Up ]
      acd47b
      [ >> ]
      4c79b5
      4c79b5

      4c79b5
       <font size="-1">
      acd47b
        This document was generated on February, 26 2011 using texi2html 1.76.
      4c79b5
       </font>
      4c79b5
       
      4c79b5
      4c79b5

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