Blame Manuals/en/Html/Repository/repository_40.html

4c79b5
4c79b5
<html>
6414c4
09d4f2
6414c4
Copyright C 2009, 2010, 2011  Alain Reguera Delgado
4c79b5
4c79b5
Permission is granted to copy, distribute and/or modify this document
4c79b5
under the terms of the GNU Free Documentation License, Version 1.2 or
4c79b5
any later version published by the Free Software Foundation; with no
4c79b5
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
4c79b5
copy of the license is included in the section entitled GNU Free
4c79b5
Documentation License.  
4c79b5
-->
92fb7f
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>
c489c0
<title>The CentOS Artwork Repository: 3.37 trunk/Scripts/Bash/Functions</title>
4c79b5
c489c0
<meta name="description" content="The CentOS Artwork Repository: 3.37 trunk/Scripts/Bash/Functions">
c489c0
<meta name="keywords" content="The CentOS Artwork Repository: 3.37 trunk/Scripts/Bash/Functions">
4c79b5
<meta name="resource-type" content="document">
4c79b5
<meta name="distribution" content="global">
4c79b5
<meta name="Generator" content="texi2html 1.76">
4c79b5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4c79b5
<style type="text/css">
4c79b5
1e9202
@import "/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/common.css";
4c79b5
4c79b5
a.summary-letter {text-decoration: none}
4c79b5
pre.display {font-family: serif}
4c79b5
pre.format {font-family: serif}
4c79b5
pre.menu-comment {font-family: serif}
4c79b5
pre.menu-preformatted {font-family: serif}
4c79b5
pre.smalldisplay {font-family: serif; font-size: smaller}
4c79b5
pre.smallexample {font-size: smaller}
4c79b5
pre.smallformat {font-family: serif; font-size: smaller}
4c79b5
pre.smalllisp {font-size: smaller}
4c79b5
span.sansserif {font-family:sans-serif; font-weight:normal;}
4c79b5
ul.toc {list-style: none}
4c79b5
-->
4c79b5
</style>
4c79b5
4c79b5
4c79b5
</head>
4c79b5
4c79b5
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
4c79b5
4c79b5
01b527
[ < ]
01b527
[ > ]
4c79b5
   
4c79b5
[ << ]
4c79b5
[ Up ]
c489c0
[ >> ]
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
[Top]
4c79b5
[Contents]
c489c0
[Index]
4c79b5
[ ? ]
4c79b5
c489c0
01b527
c489c0

3.37 trunk/Scripts/Bash/Functions

4c79b5
4c79b5
01b527
6ba043

3.37.1 Goals

6ba043
c489c0

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

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

6ba043
01b527
6ba043

3.37.2 Description

6ba043
c489c0

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

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

c489c0

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

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

c489c0

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

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

c489c0

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

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

c489c0
Info

Tip

Join CentOS developers mailing list

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

c489c0
c489c0

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

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

c489c0

OK, let's begin with our functionality example.

c489c0

c489c0

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

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

c489c0

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

c489c0

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

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

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

c489c0

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

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

c489c0

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

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

c489c0

In our greet function example, top commentary for

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

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

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

c489c0
function definition would look like the following:
c489c0

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

The first definition inside greet function, are global

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

c489c0

Later, we call greet_getActions function to define the

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

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

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

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

c489c0

The greet function definition makes available two valid

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

c489c0

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

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

c489c0

The greet_doHello and greet_doBye function definitions

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

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

The greet_doHello function definition is stored in

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

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

The greet_doBye function definition is stored in the

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

c489c0

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

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

c489c0

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

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

c489c0

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

c489c0
change it to have a little fun.
c489c0

c489c0

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

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

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

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

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

c489c0

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

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

c489c0
centos-art locale --edit
c489c0
c489c0
Warning

Warning

To translate output messages in different languages,

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

c489c0
c489c0

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

c489c0

c489c0

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

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

c489c0

The greet function described in this section may serve you as

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

c489c0

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

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

6ba043
01b527
6ba043

3.37.3 Usage

6ba043
4224f4
aaa0e9
c489c0

3.37.3.1 Global variables

c489c0
c489c0

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

c489c0
available for you to use inside specific functions:
c489c0

c489c0
c489c0
<u>Variable:</u> TEXTDOMAIN
c489c0
c489c0
c489c0

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

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

c489c0
c489c0
c489c0
<u>Variable:</u> TEXTDOMAINDIR
c489c0
c489c0
c489c0

Default directory used to retrieve translated messages. This value is

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

4224f4
c489c0
c489c0
<u>Variable:</u> FUNCNAM
c489c0
c489c0
c489c0

Define function name.

c489c0

c489c0

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

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

c489c0

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

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

c489c0

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

c489c0
immediatly ends its execution.
c489c0

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

Define action name.

c489c0

c489c0

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

c489c0
specific function.
c489c0

c489c0

Action name names aare passed as second argument in

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

c489c0

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

c489c0
immediatly ends its execution.
c489c0

c489c0
c489c0
c489c0
<u>Variable:</u> ACTIONVAL
c489c0
c489c0
c489c0

Define action value.

c489c0

c489c0

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

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

c489c0
c489c0
c489c0
<u>Variable:</u> REGEX
c489c0
c489c0
c489c0

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

c489c0
to process.
c489c0

c489c0

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

c489c0
files.
c489c0

c489c0

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

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

c489c0
c489c0
c489c0
<u>Variable:</u> ARGUMENTS
c489c0
c489c0
c489c0

Define optional arguments.

c489c0

c489c0

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

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

c489c0

Optional arguments are parsed using getopt command through

c489c0
the following base construction: 
c489c0

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

Optional arguments provide support to command options inside

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

c489c0

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

c489c0

In order for getopt to parse ARGUMENTS correctly, it

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

c489c0

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

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

c489c0

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

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

c489c0
c489c0
c489c0
<u>Variable:</u> EDITOR
c489c0
c489c0
c489c0

Default text editor.

c489c0

c489c0

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

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

c489c0

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

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

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

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

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

    c489c0
    c489c0
    c489c0
    c489c0

    3.37.3.2 Global functions

    c489c0
    c489c0

    Function scripts stored directly under

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

    c489c0
    c489c0
    <u>Function:</u> cli_checkActionArguments
    c489c0
    c489c0
    c489c0

    Validate action value (ACTIONVAL) variable.

    c489c0

    c489c0

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

    c489c0

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

      If another value different from that specified above is passed to

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

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

      Verify file existence.

      c489c0

      c489c0

      cli_checkFiles receives a FILE absolute path and performs

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

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

      Ends script execution if FILE is not a directory.

      c489c0

      c489c0

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

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

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

      Ends script execution if FILE is not a regular file.

      c489c0

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

      Ends script execution if FILE is not a symbolic link.

      c489c0

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

      Ends script execution if FILE is not executable.

      c489c0

      c489c0
      <samp>`fh'</samp>
      c489c0

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

      c489c0
      symbolic link.
      c489c0

      c489c0
      <samp>`fd'</samp>
      c489c0

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

      c489c0
      directory.
      c489c0

      c489c0
      <samp>`isInWorkingCopy'</samp>
      c489c0

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

      c489c0

      c489c0
      c489c0
      c489c0

      As default behaviour, if FILE passes all verifications,

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

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

      Syncronize changes between repository and working copy.

      c489c0

      c489c0

      The cli_commitRepoChanges function brings changes from the

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

      c489c0

      Previous to commit the working copy changes up to the central

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

      c489c0

      If LOCATION argument is not specified, the value of

      c489c0
      ACTIONVAL variable is used as reference instead.
      c489c0

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

      Figure 3.14: The cli_commitRepoChanges function output.

      c489c0
      c489c0

      c489c0

      Call the cli_commitRepoChanges function before or/and after

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

      c489c0
      c489c0
      c489c0
      <u>Function:</u> cli_doParseArguments
      c489c0
      c489c0
      c489c0

      Redefine arguments (ARGUMENTS) global variable using

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

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

      Initialize/reset arguments (ARGUMENTS) global variable using

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

      c489c0

      When we work inside function definitions, positional parameters are

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

      c489c0
      c489c0
      c489c0
      <u>Function:</u> cli_getArguments
      c489c0
      c489c0
      c489c0

      Initialize function name (FUNCNAM), action name

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

      c489c0

      The cli_getArguments function is called from cli.sh

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

      c489c0

      Once command-line positional parameters are accesible to

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0
      c489c0
      c489c0
      <u>Function:</u> cli_getFunctions
      c489c0
      c489c0
      c489c0

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

      c489c0

      c489c0

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

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

      c489c0

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

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

      c489c0

      Inside each functionality directory, the functionalty itself is

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

      c489c0

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

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

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

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

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

      c489c0

      If the functionality specified in the command-line first argument

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

      c489c0

      In order to keep visual consistency among function scripts, please

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

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

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

      c489c0

      c489c0

      The cli_getCountryCodes function outputs a list with country

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

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

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

      c489c0

      c489c0

      The cli_getCountryName function reads one language locale code

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

      c489c0
       
      c489c0
      c489c0
      <u>Function:</u> cli_getCurrentLocale
      c489c0
      c489c0
      c489c0

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

      c489c0

      c489c0

      The cli_getCurrentLocale function uses LANG environment

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

      c489c0

      The current locale information, returned by

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

      c489c0

      Locale precedence selection is quite important in order to define the

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

      c489c0

      Use cli_getCurrentLocale function to know what current locale

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

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

      Output list of files to process.

      c489c0

      c489c0

      The cli_getFilesList function uses LOCATION variable as

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

      c489c0

      If LOCATION is not specified when cli_getFilesList

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

      c489c0

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

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

      c489c0

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

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

      c489c0

      As result, the cli_getFilesList re-defines the value of

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

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

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

      c489c0

      c489c0

      cli_getLangCodes function outputs a list of language codes as

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

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

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

      c489c0

      c489c0

      cli_getLangName function reads one language locale code in the

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

      c489c0
      c489c0
      c489c0
      <u>Function:</u> cli_getLocales
      c489c0
      c489c0
      c489c0

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

      c489c0

      c489c0

      Occasionally, you use cli_getLocales function to add locale

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

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

      Sanitate file names.

      c489c0

      c489c0

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

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

      c489c0
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      c489c0
      c489c0

      The NAME variable contains the file name or directory name you

      c489c0
      want to sanitate.
      c489c0

      c489c0

      The TYPE variable specifies what type of sanitation you want to

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

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

      Sanitate directory NAMEs.

      c489c0

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

      Sanitate regular file NAMEs.

      c489c0

      c489c0
      c489c0
      c489c0

      Use cli_getRepoName function to sanitate file names and

      c489c0
      directory names before their utilization. 
      c489c0

      c489c0

      Use cli_getRepoName when you need to change file name

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

      c489c0

      When we change file name convenctions inside cli_getRepoName

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

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

      Request repository status.

      c489c0

      c489c0

      This function requests the status of a LOCATION inside the

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

      c489c0

      Use this function to perform verifications based a repository

      c489c0
      LOCATION status.
      c489c0

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

      Output absolute path to temporal file NAME.

      c489c0

      c489c0

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

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

      c489c0
      cli_getTemporalFile $FILE
      c489c0
      c489c0

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      c489c0
      c489c0
      c489c0
      <u>Function:</u> cli_getThemeName
      c489c0
      c489c0
      c489c0

      Output theme name.

      c489c0

      c489c0

      In order for cli_getThemeName function to extract theme name

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

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

      Define standard output message definition supported by

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

      c489c0

      When FORMAT is not specified, cli_printMessage outputs

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

      c489c0
      c489c0
      <samp>`AsHeadingLine'</samp>
      c489c0

      To print heading messages.

      c489c0

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

      To print warning messages.

      c489c0

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

      To print note messages.

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

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

      c489c0

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

      To print response messages on one-column format.

      c489c0

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

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

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

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

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

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

      c489c0
      $MESSAGE [y/N]:
      c489c0
      c489c0

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

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

      c489c0
      $MESSAGE [s/N]:
      c489c0
      c489c0

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

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

      c489c0

      Definition of which confirmation word to use is set on translation

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

      c489c0
      c489c0
      <samp>`AsToKnowMoreLine'</samp>
      c489c0

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

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

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

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

      c489c0
      script termination. 
      c489c0

      c489c0
      c489c0
      <samp>`AsRegularLine'</samp>
      c489c0

      To standardize regular messages on one-column format.

      c489c0

      c489c0

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

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

      c489c0
      c489c0
      c489c0

      Use cli_printMessage function whenever you need to output

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

      c489c0
      Info

      Tip

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

      c489c0

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

      3.37.3.3 Specific functions

      c489c0
      c489c0

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

      c489c0
      available for you to use:
      c489c0

      4224f4
      c489c0
      3.38 trunk/Scripts/Bash/Functions/Html  
      c489c0
      c489c0
      3.39 trunk/Scripts/Bash/Functions/Locale  
      c489c0
      c489c0
      3.40 trunk/Scripts/Bash/Functions/Manual  
      c489c0
      c489c0
      3.41 trunk/Scripts/Bash/Functions/Path  
      c489c0
      c489c0
      3.42 trunk/Scripts/Bash/Functions/Render  
      c489c0
      c489c0
      3.43 trunk/Scripts/Bash/Functions/Render/Config  
      c489c0
      c489c0
      3.44 trunk/Scripts/Bash/Functions/Shell  
      c489c0
      c489c0
      3.45 trunk/Scripts/Bash/Functions/Svg  
      aaa0e9
      c489c0
      3.46 trunk/Scripts/Bash/Functions/Verify  
      c489c0
      c489c0
      c489c0
      c489c0
      c489c0
      c489c0

      3.37.4 See also

      c489c0
      c489c0
      c489c0
      3.36 trunk/Scripts/Bash  
      63f275
      c489c0
      3.47 trunk/Scripts/Bash/Locale  
      63f275
      63f275
      4c79b5
      5fb024
      4c79b5
      c489c0
      [ < ]
      c489c0
      [ > ]
      4c79b5
         
      4c79b5
      [ << ]
      01b527
      [ Up ]
      c489c0
      [ >> ]
      4c79b5
      4c79b5

      4c79b5
       <font size="-1">
      92fb7f
        This document was generated on January, 5 2011 using texi2html 1.76.
      4c79b5
       </font>
      4c79b5
       
      4c79b5
      4c79b5

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