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

4c79b5
4c79b5
<html>
ccb7a3
4c79b5
4c79b5
Permission is granted to copy, distribute and/or modify this document
4c79b5
under the terms of the GNU Free Documentation License, Version 1.2 or
4c79b5
any later version published by the Free Software Foundation; with no
4c79b5
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
4c79b5
copy of the license is included in the section entitled GNU Free
4c79b5
Documentation License.  
4c79b5
-->
bf28e1
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>
6a8116
<title>CentOS Artwork Repository: 3.49 trunk/Scripts/Bash/Functions</title>
4c79b5
6a8116
<meta name="description" content="CentOS Artwork Repository: 3.49 trunk/Scripts/Bash/Functions">
6a8116
<meta name="keywords" content="CentOS Artwork Repository: 3.49 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
6a8116
[ < ]
6a8116
[ > ]
4c79b5
   
4c79b5
[ << ]
4c79b5
[ Up ]
6a8116
[ >> ]
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
[Top]
4c79b5
[Contents]
6a8116
[Index]
4c79b5
[ ? ]
4c79b5
6a8116
6a8116
6a8116

3.49 trunk/Scripts/Bash/Functions

6a8116
6a8116
6a8116
6a8116

3.49.1 Goals

6a8116
6a8116

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

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

6a8116
6a8116
6a8116

3.49.2 Description

6a8116
6a8116

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

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

6a8116

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

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

6a8116

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

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

6a8116

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

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

6a8116
Info

Tip

Join CentOS developers mailing list

6a8116
centos-art@centos.org to share your ideas.
6a8116

6a8116
6a8116

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

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

6a8116

OK, let's begin with our functionality example.

6a8116

6a8116

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

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

6a8116

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

6a8116

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

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

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

6a8116

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

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

6a8116

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

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

6a8116

In our greet function example, top commentary for

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

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

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

6a8116
function definition would look like the following:
6a8116

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

The first definition inside greet function, are global

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

6a8116

Later, we call greet_getActions function to define the

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

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

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

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

6a8116

The greet function definition makes available two valid

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

6a8116

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

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

6a8116

The greet_doHello and greet_doBye function definitions

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

6a8116
function greet_doHello {
6a8116
6a8116
    cli_printMessage "`gettext "Hello"` $ACTIONVAL"
6a8116
6a8116
}
6a8116
6a8116

The greet_doHello function definition is stored in

6a8116
<tt>`greet_doHello.sh'</tt> function script. 
6a8116

6a8116
function greet_doBye {
6a8116
6a8116
    cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
6a8116
6a8116
}
6a8116
6a8116

The greet_doBye function definition is stored in the

6a8116
<tt>`greet_doBye.sh'</tt> function script. 
6a8116

6a8116

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

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

6a8116

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

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

6a8116

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

6a8116
change it to have a little fun.
6a8116

6a8116

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

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

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

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

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

6a8116

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

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

6a8116
centos-art locale --edit
6a8116
6a8116
Warning

Warning

To translate output messages in different languages,

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

6a8116
6a8116

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

6a8116

6a8116

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

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

6a8116

The greet function described in this section may serve you as

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

6a8116

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

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

6a8116
2c3589
6a8116

3.49.3 Usage

2dc146
2dc146
2c3589
6a8116

3.49.3.1 Global variables

6a8116
6a8116

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

6a8116
available for you to use inside specific functions:
6a8116

6a8116
6a8116
<u>Variable:</u> TEXTDOMAIN
6a8116
6a8116
6a8116

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

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

6a8116
6a8116
6a8116
<u>Variable:</u> TEXTDOMAINDIR
6a8116
6a8116
6a8116

Default directory used to retrieve translated messages. This value is

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

6a8116
6a8116
6a8116
<u>Variable:</u> FUNCNAM
6a8116
6a8116
6a8116

Define function name.

6a8116

6a8116

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

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

6a8116

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

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

6a8116

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

6a8116
immediatly ends its execution.
6a8116

6a8116
6a8116
6a8116
<u>Variable:</u> FUNCDIR
6a8116
6a8116
6a8116
6a8116
6a8116
6a8116
<u>Variable:</u> FUNCDIRNAME
6a8116
6a8116
6a8116
6a8116
6a8116
6a8116
<u>Variable:</u> FUNCSCRIPT
6a8116
6a8116
6a8116
2dc146
6a8116
6a8116
<u>Variable:</u> FUNCCONFIG
6a8116
6a8116
6a8116
6a8116
6a8116
6a8116
<u>Variable:</u> ACTIONNAM
6a8116
6a8116
6a8116

Define action name.

6a8116

6a8116

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

6a8116
specific function.
6a8116

6a8116

Action name names aare passed as second argument in

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

6a8116

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

6a8116
immediatly ends its execution.
6a8116

6a8116
6a8116
6a8116
<u>Variable:</u> ACTIONVAL
6a8116
6a8116
6a8116

Define action value.

6a8116

6a8116

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

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

6a8116
6a8116
6a8116
<u>Variable:</u> REGEX
6a8116
6a8116
6a8116

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

6a8116
to process.
6a8116

6a8116

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

6a8116
files.
6a8116

6a8116

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

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

6a8116
6a8116
6a8116
<u>Variable:</u> ARGUMENTS
6a8116
6a8116
6a8116

Define optional arguments.

6a8116

6a8116

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

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

6a8116

Optional arguments are parsed using getopt command through

6a8116
the following base construction: 
6a8116

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

Optional arguments provide support to command options inside

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

6a8116

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

6a8116

In order for getopt to parse ARGUMENTS correctly, it

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

6a8116

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

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

6a8116

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

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

6a8116
6a8116
6a8116
<u>Variable:</u> EDITOR
6a8116
6a8116
6a8116

Default text editor.

6a8116

6a8116

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

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

6a8116

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

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

2c3589
    6a8116
  • <tt>`/usr/bin/vim'</tt>
  • 6a8116
  • <tt>`/usr/bin/emacs'</tt>
  • 6a8116
  • <tt>`/usr/bin/nano'</tt>
  • 2c3589
    2dc146
    6a8116

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

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

    6a8116
    2c3589
    2c3589
    6a8116

    3.49.3.2 Global functions

    2dc146
    6a8116

    Function scripts stored directly under

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

    6a8116
    6a8116
    <u>Function:</u> cli_checkActionArguments
    6a8116
    6a8116
    6a8116

    Validate action value (ACTIONVAL) variable.

    6a8116

    6a8116

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

    6a8116

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

      If another value different from that specified above is passed to

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      6a8116
      6a8116
      6a8116

      Verify file existence.

      6a8116

      6a8116

      cli_checkFiles receives a FILE absolute path and performs

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

      6a8116
      6a8116
      <samp>`d'</samp>
      6a8116
      <samp>`directory'</samp>
      6a8116

      Ends script execution if FILE is not a directory.

      6a8116

      6a8116

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

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

      6a8116
      6a8116
      <samp>`f'</samp>
      6a8116
      <samp>`regular-file'</samp>
      6a8116

      Ends script execution if FILE is not a regular file.

      6a8116

      6a8116
      <samp>`h'</samp>
      6a8116
      <samp>`symbolic-link'</samp>
      6a8116

      Ends script execution if FILE is not a symbolic link.

      6a8116

      6a8116
      <samp>`x'</samp>
      6a8116
      <samp>`execution'</samp>
      6a8116

      Ends script execution if FILE is not executable.

      6a8116

      6a8116
      <samp>`fh'</samp>
      6a8116

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

      6a8116
      symbolic link.
      6a8116

      6a8116
      <samp>`fd'</samp>
      6a8116

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

      6a8116
      directory.
      6a8116

      6a8116
      <samp>`isInWorkingCopy'</samp>
      6a8116

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

      6a8116

      6a8116
      6a8116
      6a8116

      As default behaviour, if FILE passes all verifications,

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_commitRepoChanges [LOCATION]
      6a8116
      6a8116
      6a8116

      Syncronize changes between repository and working copy.

      6a8116

      6a8116

      The cli_commitRepoChanges function brings changes from the

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

      6a8116

      Previous to commit the working copy changes up to the central

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

      6a8116

      If LOCATION argument is not specified, the value of

      6a8116
      ACTIONVAL variable is used as reference instead.
      6a8116

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

      Figure 3.3: The cli_commitRepoChanges function output.

      6a8116
      6a8116

      6a8116

      Call the cli_commitRepoChanges function before or/and after

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_doParseArguments
      6a8116
      6a8116
      6a8116

      Redefine arguments (ARGUMENTS) global variable using

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_doParseArgumentsReDef $@
      6a8116
      6a8116
      6a8116

      Initialize/reset arguments (ARGUMENTS) global variable using

      6a8116
      positional parameters variable ($@) as reference.
      6a8116

      6a8116

      When we work inside function definitions, positional parameters are

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getArguments
      6a8116
      6a8116
      6a8116

      Initialize function name (FUNCNAM), action name

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

      6a8116

      The cli_getArguments function is called from cli.sh

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

      6a8116

      Once command-line positional parameters are accesible to

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

      6a8116

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

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

      6a8116

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

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

      6a8116

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

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getFunctions
      6a8116
      6a8116
      6a8116

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

      6a8116

      6a8116

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

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

      6a8116

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

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

      6a8116

      Inside each functionality directory, the functionalty itself is

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

      6a8116

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

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

      6a8116
      function prefix_doSomething {
      6a8116
      6a8116
          # Do something here...
      6a8116
      6a8116
      }
      6a8116
      6a8116

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

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

      6a8116

      If the functionality specified in the command-line first argument

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

      6a8116

      In order to keep visual consistency among function scripts, please

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

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

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

      6a8116

      6a8116

      The cli_getCountryCodes function outputs a list with country

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getCountryName [FILTER]
      6a8116
      6a8116
      6a8116

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

      6a8116

      6a8116

      The cli_getCountryName function reads one language locale code

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

      6a8116
       
      6a8116
      6a8116
      <u>Function:</u> cli_getCurrentLocale
      6a8116
      6a8116
      6a8116

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

      6a8116

      6a8116

      The cli_getCurrentLocale function uses LANG environment

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

      6a8116

      The current locale information, returned by

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

      6a8116

      Locale precedence selection is quite important in order to define the

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

      6a8116

      Use cli_getCurrentLocale function to know what current locale

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getFilesList [LOCATION]
      6a8116
      6a8116
      6a8116

      Output list of files to process.

      6a8116

      6a8116

      The cli_getFilesList function uses LOCATION variable as

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

      6a8116

      If LOCATION is not specified when cli_getFilesList

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

      6a8116

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

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

      6a8116

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

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

      6a8116

      As result, the cli_getFilesList re-defines the value of

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

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

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

      6a8116

      6a8116

      cli_getLangCodes function outputs a list of language codes as

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getLangName [FILTER]
      6a8116
      6a8116
      6a8116

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

      6a8116

      6a8116

      cli_getLangName function reads one language locale code in the

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getLocales
      6a8116
      6a8116
      6a8116

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

      6a8116

      6a8116

      Occasionally, you use cli_getLocales function to add locale

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getRepoName NAME TYPE
      6a8116
      6a8116
      6a8116

      Sanitate file names.

      6a8116

      6a8116

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

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

      6a8116
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      6a8116
      6a8116

      The NAME variable contains the file name or directory name you

      6a8116
      want to sanitate.
      6a8116

      6a8116

      The TYPE variable specifies what type of sanitation you want to

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

      6a8116
      6a8116
      <samp>`d'</samp>
      6a8116
      <samp>`directory'</samp>
      6a8116

      Sanitate directory NAMEs.

      6a8116

      6a8116
      <samp>`f'</samp>
      6a8116
      <samp>`regular-file'</samp>
      6a8116

      Sanitate regular file NAMEs.

      6a8116

      6a8116
      6a8116
      6a8116

      Use cli_getRepoName function to sanitate file names and

      6a8116
      directory names before their utilization. 
      6a8116

      6a8116

      Use cli_getRepoName when you need to change file name

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

      6a8116

      When we change file name convenctions inside cli_getRepoName

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getRepoStatus [LOCATION]
      6a8116
      6a8116
      6a8116

      Request repository status.

      6a8116

      6a8116

      This function requests the status of a LOCATION inside the

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

      6a8116

      Use this function to perform verifications based a repository

      6a8116
      LOCATION status.
      6a8116

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getTemporalFile NAME
      6a8116
      6a8116
      6a8116

      Output absolute path to temporal file NAME.

      6a8116

      6a8116

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

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

      6a8116
      cli_getTemporalFile $FILE
      6a8116
      6a8116

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_getThemeName
      6a8116
      6a8116
      6a8116

      Output theme name.

      6a8116

      6a8116

      In order for cli_getThemeName function to extract theme name

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

      6a8116
      6a8116
      6a8116
      <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
      6a8116
      6a8116
      6a8116

      Define standard output message definition supported by

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

      6a8116

      When FORMAT is not specified, cli_printMessage outputs

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

      6a8116
      6a8116
      <samp>`AsHeadingLine'</samp>
      6a8116

      To print heading messages.

      6a8116

      ----------------------------------------------------------------------
      6a8116
      $MESSAGE
      6a8116
      ----------------------------------------------------------------------
      6a8116
      6a8116
      6a8116
      <samp>`AsWarningLine'</samp>
      6a8116

      To print warning messages.

      6a8116

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

      To print note messages.

      6a8116

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

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

      6a8116

      Updating        $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsRemovingLine'</samp>
      6a8116

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

      6a8116

      Removing        $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsCheckingLine'</samp>
      6a8116

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

      6a8116

      Checking        $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsCreatingLine'</samp>
      6a8116

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

      6a8116

      Creating        $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsSavedAsLine'</samp>
      6a8116

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

      6a8116

      Saved as        $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsLinkToLine'</samp>
      6a8116

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

      6a8116

      Linked to       $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsMovedToLine'</samp>
      6a8116

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

      6a8116

      Moved to        $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsTranslationLine'</samp>
      6a8116

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

      6a8116

      Translation     $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsConfigurationLine'</samp>
      6a8116

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

      6a8116

      Configuration   $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsResponseLine'</samp>
      6a8116

      To print response messages on one-column format.

      6a8116

      --> $MESSAGE
      6a8116
      6a8116
      6a8116
      <samp>`AsRequestLine'</samp>
      6a8116

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

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

      $MESSAGE:
      6a8116
      6a8116
      6a8116
      <samp>`AsYesOrNoRequestLine'</samp>
      6a8116

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

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

      6a8116
      $MESSAGE [y/N]:
      6a8116
      6a8116

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

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

      6a8116
      $MESSAGE [s/N]:
      6a8116
      6a8116

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

      6a8116
      <samp>`sí'</samp> word.
      6a8116

      6a8116

      Definition of which confirmation word to use is set on translation

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

      6a8116
      6a8116
      <samp>`AsToKnowMoreLine'</samp>
      6a8116

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

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

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

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

      6a8116
      script termination. 
      6a8116

      6a8116
      6a8116
      <samp>`AsRegularLine'</samp>
      6a8116

      To standardize regular messages on one-column format.

      6a8116

      6a8116

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

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

      6a8116
      6a8116
      6a8116

      Use cli_printMessage function whenever you need to output

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

      6a8116
      Info

      Tip

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

      6a8116

      trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
      6a8116
      6a8116
      7e35dc
      2c3589
      2c3589
      6a8116

      3.49.3.3 Specific functions

      7e35dc
      6a8116

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

      6a8116
      available for you to use:
      6a8116

      6a8116
      6a8116
      3.50 trunk/Scripts/Bash/Functions/Html  
      6a8116
      6a8116
      3.51 trunk/Scripts/Bash/Functions/Locale  
      6a8116
      6a8116
      3.52 trunk/Scripts/Bash/Functions/Manual  
      6a8116
      6a8116
      3.53 trunk/Scripts/Bash/Functions/Path  
      6a8116
      6a8116
      3.54 trunk/Scripts/Bash/Functions/Render  
      6a8116
      6a8116
      3.55 trunk/Scripts/Bash/Functions/Render/Config  
      6a8116
      6a8116
      3.56 trunk/Scripts/Bash/Functions/Shell  
      6a8116
      6a8116
      3.57 trunk/Scripts/Bash/Functions/Svg  
      6a8116
      6a8116
      3.58 trunk/Scripts/Bash/Functions/Verify  
      6a8116
      6a8116
      7e35dc
      2c3589
      2c3589
      7e35dc

      3.49.4 See also

      7e35dc
      6a8116
      6a8116
      3.48 trunk/Scripts/Bash  
      6a8116
      6a8116
      3.59 trunk/Scripts/Bash/Locale  
      6a8116
      6a8116
      4c79b5
      4c79b5
      4c79b5
      2c3589
      [ < ]
      2c3589
      [ > ]
      4c79b5
         
      4c79b5
      [ << ]
      6a8116
      [ Up ]
      6a8116
      [ >> ]
      4c79b5
      4c79b5

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

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