Blame Manual/repository-html/repository_52.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
-->
406f69
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>
aaf678
<title>CentOS Artwork Repository: 1.51 The Filesystem/trunk/Scripts/Bash/Cli/Functions Directory</title>
ee1f37
aaf678
<meta name="description" content="CentOS Artwork Repository: 1.51 The Filesystem/trunk/Scripts/Bash/Cli/Functions Directory">
aaf678
<meta name="keywords" content="CentOS Artwork Repository: 1.51 The Filesystem/trunk/Scripts/Bash/Cli/Functions Directory">
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
982d5c
[ < ]
aaf678
[ > ]
ee1f37
   
aaf678
[ << ]
aaf678
[ Up ]
aaf678
[ >> ]
ee1f37
   
ee1f37
   
ee1f37
   
ee1f37
   
56a476
[Top]
56a476
[Contents]
5cb5a7
[Index]
56a476
[ ? ]
ee1f37
aaf678
65cd8a
aaf678

1.51 The <tt>`Filesystem/trunk/Scripts/Bash/Cli/Functions'</tt> Directory

ee1f37
ee1f37
aaf678
aaf678

1.51.1 Goals

aaf678
aaf678

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

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

aaf678
aaf678
aaf678

1.51.2 Description

aaf678
aaf678

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

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

aaf678

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

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

aaf678

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

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

aaf678

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

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

aaf678
Info

Tip

Join CentOS developers mailing list

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

aaf678
aaf678

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

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

aaf678

OK, let's begin with our functionality example.

aaf678

aaf678

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

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

aaf678

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

aaf678

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

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

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

aaf678

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

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

aaf678

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

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

aaf678

In our greet function example, top commentary for

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

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

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

aaf678
function definition would look like the following:
aaf678

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

The first definition inside greet function, are global

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

aaf678

Later, we call greet_getActions function to define the

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

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

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

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

aaf678

The greet function definition makes available two valid

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

aaf678

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

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

aaf678

The greet_doHello and greet_doBye function definitions

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

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

The greet_doHello function definition is stored in

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

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

The greet_doBye function definition is stored in the

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

aaf678

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

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

aaf678

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

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

aaf678

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

aaf678
change it to have a little fun.
aaf678

aaf678

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

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

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

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

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

aaf678

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

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

aaf678
centos-art locale --edit
aaf678
aaf678
Warning

Warning

To translate output messages in different languages,

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

aaf678
aaf678

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

aaf678

aaf678

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

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

aaf678

The greet function described in this section may serve you as

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

aaf678

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

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

aaf678
aaf678
aaf678

1.51.3 Usage

aaf678
aaf678
aaf678
aaf678

1.51.3.1 Global variables

aaf678
aaf678

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

aaf678
available for you to use inside specific functions:
aaf678

aaf678
aaf678
<u>Variable:</u> TEXTDOMAIN
aaf678
aaf678
aaf678

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

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

aaf678
aaf678
aaf678
<u>Variable:</u> TEXTDOMAINDIR
aaf678
aaf678
aaf678

Default directory used to retrieve translated messages. This value is

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

aaf678
aaf678
aaf678
<u>Variable:</u> FUNCNAM
aaf678
aaf678
aaf678

Define function name.

aaf678

aaf678

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

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

aaf678

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

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

aaf678

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

aaf678
immediatly ends its execution.
aaf678

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

Define action name.

aaf678

aaf678

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

aaf678
specific function.
aaf678

aaf678

Action name names aare passed as second argument in

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

aaf678

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

aaf678
immediatly ends its execution.
aaf678

aaf678
aaf678
aaf678
<u>Variable:</u> ACTIONVAL
aaf678
aaf678
aaf678

Define action value.

aaf678

aaf678

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

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

aaf678
aaf678
aaf678
<u>Variable:</u> REGEX
aaf678
aaf678
aaf678

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

aaf678
to process.
aaf678

aaf678

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

aaf678
files.
aaf678

aaf678

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

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

aaf678
aaf678
aaf678
<u>Variable:</u> ARGUMENTS
aaf678
aaf678
aaf678

Define optional arguments.

aaf678

aaf678

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

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

aaf678

Optional arguments are parsed using getopt command through

aaf678
the following base construction: 
aaf678

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

Optional arguments provide support to command options inside

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

aaf678

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

aaf678

In order for getopt to parse ARGUMENTS correctly, it

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

aaf678

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

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

aaf678

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

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

aaf678
aaf678
aaf678
<u>Variable:</u> EDITOR
aaf678
aaf678
aaf678

Default text editor.

aaf678

aaf678

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

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

aaf678

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

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

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

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

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

    aaf678
    aaf678
    aaf678
    aaf678

    1.51.3.2 Global functions

    aaf678
    aaf678

    Function scripts stored directly under

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

    aaf678
    aaf678
    <u>Function:</u> cli_checkActionArguments
    aaf678
    aaf678
    aaf678

    Validate action value (ACTIONVAL) variable.

    aaf678

    aaf678

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

    aaf678

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

      If another value different from that specified above is passed to

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

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

      Verify file existence.

      aaf678

      aaf678

      cli_checkFiles receives a FILE absolute path and performs

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

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

      Ends script execution if FILE is not a directory.

      aaf678

      aaf678

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

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

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

      Ends script execution if FILE is not a regular file.

      aaf678

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

      Ends script execution if FILE is not a symbolic link.

      aaf678

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

      Ends script execution if FILE is not executable.

      aaf678

      aaf678
      <samp>`fh'</samp>
      aaf678

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

      aaf678
      symbolic link.
      aaf678

      aaf678
      <samp>`fd'</samp>
      aaf678

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

      aaf678
      directory.
      aaf678

      aaf678
      <samp>`isInWorkingCopy'</samp>
      aaf678

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

      aaf678

      aaf678
      aaf678
      aaf678

      As default behaviour, if FILE passes all verifications,

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

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

      Syncronize changes between repository and working copy.

      aaf678

      aaf678

      The cli_commitRepoChanges function brings changes from the

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

      aaf678

      Previous to commit the working copy changes up to the central

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

      aaf678

      If LOCATION argument is not specified, the value of

      aaf678
      ACTIONVAL variable is used as reference instead.
      aaf678

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

      Figure 1.3: The cli_commitRepoChanges function output.

      aaf678
      aaf678

      aaf678

      Call the cli_commitRepoChanges function before or/and after

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

      aaf678
      aaf678
      aaf678
      <u>Function:</u> cli_doParseArguments
      aaf678
      aaf678
      aaf678

      Redefine arguments (ARGUMENTS) global variable using

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

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

      Initialize/reset arguments (ARGUMENTS) global variable using

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

      aaf678

      When we work inside function definitions, positional parameters are

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

      aaf678
      aaf678
      aaf678
      <u>Function:</u> cli_getArguments
      aaf678
      aaf678
      aaf678

      Initialize function name (FUNCNAM), action name

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

      aaf678

      The cli_getArguments function is called from cli.sh

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

      aaf678

      Once command-line positional parameters are accesible to

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678
      aaf678
      aaf678
      <u>Function:</u> cli_getFunctions
      aaf678
      aaf678
      aaf678

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

      aaf678

      aaf678

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

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

      aaf678

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

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

      aaf678

      Inside each functionality directory, the functionalty itself is

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

      aaf678

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

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

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

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

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

      aaf678

      If the functionality specified in the command-line first argument

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

      aaf678

      In order to keep visual consistency among function scripts, please

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

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

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

      aaf678

      aaf678

      The cli_getCountryCodes function outputs a list with country

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

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

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

      aaf678

      aaf678

      The cli_getCountryName function reads one language locale code

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

      aaf678
       
      aaf678
      aaf678
      <u>Function:</u> cli_getCurrentLocale
      aaf678
      aaf678
      aaf678

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

      aaf678

      aaf678

      The cli_getCurrentLocale function uses LANG environment

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

      aaf678

      The current locale information, returned by

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

      aaf678

      Locale precedence selection is quite important in order to define the

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

      aaf678

      Use cli_getCurrentLocale function to know what current locale

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

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

      Output list of files to process.

      aaf678

      aaf678

      The cli_getFilesList function uses LOCATION variable as

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

      aaf678

      If LOCATION is not specified when cli_getFilesList

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

      aaf678

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

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

      aaf678

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

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

      aaf678

      As result, the cli_getFilesList re-defines the value of

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

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

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

      aaf678

      aaf678

      cli_getLangCodes function outputs a list of language codes as

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

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

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

      aaf678

      aaf678

      cli_getLangName function reads one language locale code in the

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

      aaf678
      aaf678
      aaf678
      <u>Function:</u> cli_getLocales
      aaf678
      aaf678
      aaf678

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

      aaf678

      aaf678

      Occasionally, you use cli_getLocales function to add locale

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

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

      Sanitate file names.

      aaf678

      aaf678

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

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

      aaf678
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      aaf678
      aaf678

      The NAME variable contains the file name or directory name you

      aaf678
      want to sanitate.
      aaf678

      aaf678

      The TYPE variable specifies what type of sanitation you want to

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

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

      Sanitate directory NAMEs.

      aaf678

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

      Sanitate regular file NAMEs.

      aaf678

      aaf678
      aaf678
      aaf678

      Use cli_getRepoName function to sanitate file names and

      aaf678
      directory names before their utilization. 
      aaf678

      aaf678

      Use cli_getRepoName when you need to change file name

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

      aaf678

      When we change file name convenctions inside cli_getRepoName

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

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

      Request repository status.

      aaf678

      aaf678

      This function requests the status of a LOCATION inside the

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

      aaf678

      Use this function to perform verifications based a repository

      aaf678
      LOCATION status.
      aaf678

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

      Output absolute path to temporal file NAME.

      aaf678

      aaf678

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

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

      aaf678
      cli_getTemporalFile $FILE
      aaf678
      aaf678

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      aaf678
      aaf678
      aaf678
      <u>Function:</u> cli_getThemeName
      aaf678
      aaf678
      aaf678

      Output theme name.

      aaf678

      aaf678

      In order for cli_getThemeName function to extract theme name

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

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

      Define standard output message definition supported by

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

      aaf678

      When FORMAT is not specified, cli_printMessage outputs

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

      aaf678
      aaf678
      <samp>`AsHeadingLine'</samp>
      aaf678

      To print heading messages.

      aaf678

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

      To print warning messages.

      aaf678

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

      To print note messages.

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

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

      aaf678

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

      To print response messages on one-column format.

      aaf678

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

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

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

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

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

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

      aaf678
      $MESSAGE [y/N]:
      aaf678
      aaf678

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

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

      aaf678
      $MESSAGE [s/N]:
      aaf678
      aaf678

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

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

      aaf678

      Definition of which confirmation word to use is set on translation

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

      aaf678
      aaf678
      <samp>`AsToKnowMoreLine'</samp>
      aaf678

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

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

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

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

      aaf678
      script termination. 
      aaf678

      aaf678
      aaf678
      <samp>`AsRegularLine'</samp>
      aaf678

      To standardize regular messages on one-column format.

      aaf678

      aaf678

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

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

      aaf678
      aaf678
      aaf678

      Use cli_printMessage function whenever you need to output

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

      aaf678
      Info

      Tip

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

      aaf678

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

      1.51.3.3 Specific functions

      aaf678
      aaf678

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

      aaf678
      available for you to use:
      aaf678

      aaf678
      aaf678
      aaf678
      aaf678

      1.51.4 See also

      aaf678
      aaf678
      aaf678
      1.49 The <tt>`Filesystem/trunk/Scripts/Bash'</tt> Directory  
      aaf678
      aaf678
      aaf678
      ee1f37
      ee1f37
      aaf678
      [ < ]
      aaf678
      [ > ]
      ee1f37
         
      aaf678
      [ << ]
      aaf678
      [ Up ]
      aaf678
      [ >> ]
      ee1f37
      ee1f37

      ee1f37
       <font size="-1">
      406f69
        This document was generated on March, 1 2011 using texi2html 1.76.
      ee1f37
       </font>
      ee1f37
       
      ee1f37
      ee1f37

      ee1f37
      </body>
      ee1f37
      </html>