Blame Manuals/Filesystem/filesystem-html/filesystem_53.html

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

3.50 trunk/Scripts/Bash/Functions

ee1f37
ee1f37
010b2d
ee1f37

3.50.1 Goals

ee1f37
010b2d

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

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

ee1f37
010b2d
ee1f37

3.50.2 Description

ee1f37
010b2d

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

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

010b2d

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

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

010b2d

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

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

010b2d

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

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

010b2d
Info

Tip

Join CentOS developers mailing list

010b2d
centos-art@centos.org to share your ideas.
010b2d

010b2d
010b2d

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

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

010b2d

OK, let's begin with our functionality example.

010b2d

010b2d

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

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

010b2d

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

010b2d

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

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

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

010b2d

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

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

010b2d

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

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

010b2d

In our greet function example, top commentary for

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

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

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

010b2d
function definition would look like the following:
010b2d

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

The first definition inside greet function, are global

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

010b2d

Later, we call greet_getActions function to define the

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

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

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

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

010b2d

The greet function definition makes available two valid

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

010b2d

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

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

010b2d

The greet_doHello and greet_doBye function definitions

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

010b2d
function greet_doHello {
010b2d
010b2d
    cli_printMessage "`gettext "Hello"` $ACTIONVAL"
010b2d
010b2d
}
010b2d
010b2d

The greet_doHello function definition is stored in

010b2d
<tt>`greet_doHello.sh'</tt> function script. 
010b2d

010b2d
function greet_doBye {
010b2d
010b2d
    cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
010b2d
010b2d
}
010b2d
010b2d

The greet_doBye function definition is stored in the

010b2d
<tt>`greet_doBye.sh'</tt> function script. 
010b2d

010b2d

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

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

010b2d

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

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

010b2d

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

010b2d
change it to have a little fun.
010b2d

010b2d

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

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

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

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

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

010b2d

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

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

010b2d
centos-art locale --edit
010b2d
010b2d
Warning

Warning

To translate output messages in different languages,

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

010b2d
010b2d

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

010b2d

010b2d

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

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

010b2d

The greet function described in this section may serve you as

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

010b2d

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

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

010b2d
010b2d
010b2d

3.50.3 Usage

010b2d
010b2d
010b2d
010b2d

3.50.3.1 Global variables

010b2d
010b2d

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

010b2d
available for you to use inside specific functions:
010b2d

010b2d
010b2d
<u>Variable:</u> TEXTDOMAIN
010b2d
010b2d
010b2d

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

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

010b2d
010b2d
010b2d
<u>Variable:</u> TEXTDOMAINDIR
010b2d
010b2d
010b2d

Default directory used to retrieve translated messages. This value is

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

010b2d
010b2d
010b2d
<u>Variable:</u> FUNCNAM
010b2d
010b2d
010b2d

Define function name.

010b2d

010b2d

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

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

010b2d

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

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

010b2d

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

010b2d
immediatly ends its execution.
010b2d

010b2d
010b2d
010b2d
<u>Variable:</u> FUNCDIR
010b2d
010b2d
010b2d
010b2d
010b2d
010b2d
<u>Variable:</u> FUNCDIRNAME
010b2d
010b2d
010b2d
010b2d
010b2d
010b2d
<u>Variable:</u> FUNCSCRIPT
010b2d
010b2d
010b2d
010b2d
010b2d
010b2d
<u>Variable:</u> FUNCCONFIG
010b2d
010b2d
010b2d
010b2d
010b2d
010b2d
<u>Variable:</u> ACTIONNAM
010b2d
010b2d
010b2d

Define action name.

010b2d

010b2d

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

010b2d
specific function.
010b2d

010b2d

Action name names aare passed as second argument in

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

010b2d

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

010b2d
immediatly ends its execution.
010b2d

010b2d
010b2d
010b2d
<u>Variable:</u> ACTIONVAL
010b2d
010b2d
010b2d

Define action value.

010b2d

010b2d

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

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

010b2d
010b2d
010b2d
<u>Variable:</u> REGEX
010b2d
010b2d
010b2d

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

010b2d
to process.
010b2d

010b2d

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

010b2d
files.
010b2d

010b2d

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

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

ee1f37
010b2d
010b2d
<u>Variable:</u> ARGUMENTS
010b2d
010b2d
010b2d

Define optional arguments.

010b2d

010b2d

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

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

010b2d

Optional arguments are parsed using getopt command through

010b2d
the following base construction: 
010b2d

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

Optional arguments provide support to command options inside

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

010b2d

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

010b2d

In order for getopt to parse ARGUMENTS correctly, it

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

010b2d

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

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

010b2d

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

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

010b2d
010b2d
010b2d
<u>Variable:</u> EDITOR
010b2d
010b2d
010b2d

Default text editor.

010b2d

010b2d

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

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

010b2d

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

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

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

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

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

    ee1f37
    ee1f37
    010b2d
    010b2d

    3.50.3.2 Global functions

    010b2d
    010b2d

    Function scripts stored directly under

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

    010b2d
    010b2d
    <u>Function:</u> cli_checkActionArguments
    010b2d
    010b2d
    010b2d

    Validate action value (ACTIONVAL) variable.

    010b2d

    010b2d

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

    010b2d

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

      If another value different from that specified above is passed to

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      010b2d
      010b2d
      010b2d

      Verify file existence.

      010b2d

      010b2d

      cli_checkFiles receives a FILE absolute path and performs

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

      010b2d
      010b2d
      <samp>`d'</samp>
      010b2d
      <samp>`directory'</samp>
      010b2d

      Ends script execution if FILE is not a directory.

      010b2d

      010b2d

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

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

      010b2d
      010b2d
      <samp>`f'</samp>
      010b2d
      <samp>`regular-file'</samp>
      010b2d

      Ends script execution if FILE is not a regular file.

      010b2d

      010b2d
      <samp>`h'</samp>
      010b2d
      <samp>`symbolic-link'</samp>
      010b2d

      Ends script execution if FILE is not a symbolic link.

      010b2d

      010b2d
      <samp>`x'</samp>
      010b2d
      <samp>`execution'</samp>
      010b2d

      Ends script execution if FILE is not executable.

      010b2d

      010b2d
      <samp>`fh'</samp>
      010b2d

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

      010b2d
      symbolic link.
      010b2d

      010b2d
      <samp>`fd'</samp>
      010b2d

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

      010b2d
      directory.
      010b2d

      010b2d
      <samp>`isInWorkingCopy'</samp>
      010b2d

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

      010b2d

      010b2d
      010b2d
      010b2d

      As default behaviour, if FILE passes all verifications,

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_commitRepoChanges [LOCATION]
      010b2d
      010b2d
      010b2d

      Syncronize changes between repository and working copy.

      010b2d

      010b2d

      The cli_commitRepoChanges function brings changes from the

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

      010b2d

      Previous to commit the working copy changes up to the central

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

      010b2d

      If LOCATION argument is not specified, the value of

      010b2d
      ACTIONVAL variable is used as reference instead.
      010b2d

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

      Figure 3.3: The cli_commitRepoChanges function output.

      010b2d
      010b2d

      010b2d

      Call the cli_commitRepoChanges function before or/and after

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_doParseArguments
      010b2d
      010b2d
      010b2d

      Redefine arguments (ARGUMENTS) global variable using

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_doParseArgumentsReDef $@
      010b2d
      010b2d
      010b2d

      Initialize/reset arguments (ARGUMENTS) global variable using

      010b2d
      positional parameters variable ($@) as reference.
      010b2d

      010b2d

      When we work inside function definitions, positional parameters are

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getArguments
      010b2d
      010b2d
      010b2d

      Initialize function name (FUNCNAM), action name

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

      010b2d

      The cli_getArguments function is called from cli.sh

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

      010b2d

      Once command-line positional parameters are accesible to

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

      010b2d

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

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

      010b2d

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

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

      010b2d

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

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getFunctions
      010b2d
      010b2d
      010b2d

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

      010b2d

      010b2d

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

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

      010b2d

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

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

      010b2d

      Inside each functionality directory, the functionalty itself is

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

      010b2d

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

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

      010b2d
      function prefix_doSomething {
      010b2d
      010b2d
          # Do something here...
      010b2d
      010b2d
      }
      010b2d
      010b2d

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

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

      010b2d

      If the functionality specified in the command-line first argument

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

      010b2d

      In order to keep visual consistency among function scripts, please

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

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

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

      010b2d

      010b2d

      The cli_getCountryCodes function outputs a list with country

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getCountryName [FILTER]
      010b2d
      010b2d
      010b2d

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

      010b2d

      010b2d

      The cli_getCountryName function reads one language locale code

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

      010b2d
       
      010b2d
      010b2d
      <u>Function:</u> cli_getCurrentLocale
      010b2d
      010b2d
      010b2d

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

      010b2d

      010b2d

      The cli_getCurrentLocale function uses LANG environment

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

      010b2d

      The current locale information, returned by

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

      010b2d

      Locale precedence selection is quite important in order to define the

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

      010b2d

      Use cli_getCurrentLocale function to know what current locale

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getFilesList [LOCATION]
      010b2d
      010b2d
      010b2d

      Output list of files to process.

      010b2d

      010b2d

      The cli_getFilesList function uses LOCATION variable as

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

      010b2d

      If LOCATION is not specified when cli_getFilesList

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

      010b2d

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

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

      010b2d

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

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

      010b2d

      As result, the cli_getFilesList re-defines the value of

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

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

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

      010b2d

      010b2d

      cli_getLangCodes function outputs a list of language codes as

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getLangName [FILTER]
      010b2d
      010b2d
      010b2d

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

      010b2d

      010b2d

      cli_getLangName function reads one language locale code in the

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getLocales
      010b2d
      010b2d
      010b2d

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

      010b2d

      010b2d

      Occasionally, you use cli_getLocales function to add locale

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getRepoName NAME TYPE
      010b2d
      010b2d
      010b2d

      Sanitate file names.

      010b2d

      010b2d

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

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

      010b2d
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      010b2d
      010b2d

      The NAME variable contains the file name or directory name you

      010b2d
      want to sanitate.
      010b2d

      010b2d

      The TYPE variable specifies what type of sanitation you want to

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

      ee1f37
      010b2d
      <samp>`d'</samp>
      010b2d
      <samp>`directory'</samp>
      010b2d

      Sanitate directory NAMEs.

      ee1f37

      010b2d
      <samp>`f'</samp>
      010b2d
      <samp>`regular-file'</samp>
      010b2d

      Sanitate regular file NAMEs.

      010b2d

      010b2d
      010b2d
      010b2d

      Use cli_getRepoName function to sanitate file names and

      010b2d
      directory names before their utilization. 
      010b2d

      010b2d

      Use cli_getRepoName when you need to change file name

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

      010b2d

      When we change file name convenctions inside cli_getRepoName

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getRepoStatus [LOCATION]
      010b2d
      010b2d
      010b2d

      Request repository status.

      010b2d

      010b2d

      This function requests the status of a LOCATION inside the

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

      010b2d

      Use this function to perform verifications based a repository

      010b2d
      LOCATION status.
      010b2d

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getTemporalFile NAME
      010b2d
      010b2d
      010b2d

      Output absolute path to temporal file NAME.

      010b2d

      010b2d

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

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

      010b2d
      cli_getTemporalFile $FILE
      010b2d
      010b2d

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_getThemeName
      010b2d
      010b2d
      010b2d

      Output theme name.

      010b2d

      010b2d

      In order for cli_getThemeName function to extract theme name

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

      010b2d
      010b2d
      010b2d
      <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
      010b2d
      010b2d
      010b2d

      Define standard output message definition supported by

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

      010b2d

      When FORMAT is not specified, cli_printMessage outputs

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

      010b2d
      010b2d
      <samp>`AsHeadingLine'</samp>
      010b2d

      To print heading messages.

      010b2d

      ----------------------------------------------------------------------
      010b2d
      $MESSAGE
      010b2d
      ----------------------------------------------------------------------
      010b2d
      010b2d
      010b2d
      <samp>`AsWarningLine'</samp>
      010b2d

      To print warning messages.

      010b2d

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

      To print note messages.

      010b2d

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

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

      010b2d

      Updating        $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsRemovingLine'</samp>
      010b2d

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

      010b2d

      Removing        $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsCheckingLine'</samp>
      010b2d

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

      010b2d

      Checking        $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsCreatingLine'</samp>
      010b2d

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

      010b2d

      Creating        $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsSavedAsLine'</samp>
      010b2d

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

      010b2d

      Saved as        $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsLinkToLine'</samp>
      010b2d

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

      010b2d

      Linked to       $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsMovedToLine'</samp>
      010b2d

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

      010b2d

      Moved to        $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsTranslationLine'</samp>
      010b2d

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

      010b2d

      Translation     $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsConfigurationLine'</samp>
      010b2d

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

      010b2d

      Configuration   $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsResponseLine'</samp>
      010b2d

      To print response messages on one-column format.

      010b2d

      --> $MESSAGE
      010b2d
      010b2d
      010b2d
      <samp>`AsRequestLine'</samp>
      010b2d

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

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

      $MESSAGE:
      010b2d
      010b2d
      010b2d
      <samp>`AsYesOrNoRequestLine'</samp>
      010b2d

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

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

      010b2d
      $MESSAGE [y/N]:
      010b2d
      010b2d

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

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

      010b2d
      $MESSAGE [s/N]:
      010b2d
      010b2d

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

      010b2d
      <samp>`sí'</samp> word.
      010b2d

      010b2d

      Definition of which confirmation word to use is set on translation

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

      010b2d
      010b2d
      <samp>`AsToKnowMoreLine'</samp>
      010b2d

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

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

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

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

      010b2d
      script termination. 
      010b2d

      010b2d
      010b2d
      <samp>`AsRegularLine'</samp>
      010b2d

      To standardize regular messages on one-column format.

      010b2d

      010b2d

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

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

      ee1f37
      ee1f37
      010b2d

      Use cli_printMessage function whenever you need to output

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

      010b2d
      Info

      Tip

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

      010b2d

      trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
      010b2d
      010b2d
      010b2d
      010b2d
      010b2d
      010b2d

      3.50.3.3 Specific functions

      010b2d
      010b2d

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

      010b2d
      available for you to use:
      010b2d

      010b2d
      010b2d
      3.51 trunk/Scripts/Bash/Functions/Html  
      010b2d
      010b2d
      3.52 trunk/Scripts/Bash/Functions/Locale  
      010b2d
      010b2d
      3.53 trunk/Scripts/Bash/Functions/Manual  
      010b2d
      010b2d
      3.54 trunk/Scripts/Bash/Functions/Path  
      010b2d
      010b2d
      3.55 trunk/Scripts/Bash/Functions/Render  
      010b2d
      010b2d
      3.56 trunk/Scripts/Bash/Functions/Render/Config  
      010b2d
      010b2d
      3.57 trunk/Scripts/Bash/Functions/Shell  
      010b2d
      010b2d
      3.58 trunk/Scripts/Bash/Functions/Svg  
      010b2d
      010b2d
      3.59 trunk/Scripts/Bash/Functions/Verify  
      010b2d
      010b2d
      010b2d
      ee1f37
      010b2d
      ee1f37

      3.50.4 See also

      ee1f37
      010b2d
      010b2d
      3.47 trunk/Scripts/Bash  
      010b2d
      010b2d
      3.60 trunk/Scripts/Bash/Locale  
      010b2d
      010b2d
      ee1f37
      ee1f37
      ee1f37
      010b2d
      [ < ]
      010b2d
      [ > ]
      ee1f37
         
      db14a4
      [ << ]
      010b2d
      [ Up ]
      010b2d
      [ >> ]
      ee1f37
      ee1f37

      ee1f37
       <font size="-1">
      010b2d
        This document was generated on February, 28 2011 using texi2html 1.76.
      ee1f37
       </font>
      ee1f37
       
      ee1f37
      ee1f37

      ee1f37
      </body>
      ee1f37
      </html>