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>
42563b
<title>CentOS Artwork Repository: 3.49 trunk/Scripts/Bash/Functions</title>
4c79b5
42563b
<meta name="description" content="CentOS Artwork Repository: 3.49 trunk/Scripts/Bash/Functions">
42563b
<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
42563b
[ < ]
42563b
[ > ]
4c79b5
   
4c79b5
[ << ]
4c79b5
[ Up ]
42563b
[ >> ]
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
[Top]
4c79b5
[Contents]
42563b
[Index]
4c79b5
[ ? ]
4c79b5
42563b
42563b
42563b

3.49 trunk/Scripts/Bash/Functions

42563b
42563b
42563b
42563b

3.49.1 Goals

42563b
42563b

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

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

42563b
42563b
42563b

3.49.2 Description

42563b
42563b

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

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

42563b

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

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

42563b

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

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

42563b

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

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

42563b
Info

Tip

Join CentOS developers mailing list

42563b
centos-art@centos.org to share your ideas.
42563b

42563b
42563b

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

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

42563b

OK, let's begin with our functionality example.

42563b

42563b

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

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

42563b

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

42563b

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

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

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

42563b

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

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

42563b

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

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

42563b

In our greet function example, top commentary for

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

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

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

42563b
function definition would look like the following:
42563b

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

The first definition inside greet function, are global

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

42563b

Later, we call greet_getActions function to define the

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

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

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

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

42563b

The greet function definition makes available two valid

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

42563b

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

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

42563b

The greet_doHello and greet_doBye function definitions

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

42563b
function greet_doHello {
42563b
42563b
    cli_printMessage "`gettext "Hello"` $ACTIONVAL"
42563b
42563b
}
42563b
42563b

The greet_doHello function definition is stored in

42563b
<tt>`greet_doHello.sh'</tt> function script. 
42563b

42563b
function greet_doBye {
42563b
42563b
    cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
42563b
42563b
}
42563b
42563b

The greet_doBye function definition is stored in the

42563b
<tt>`greet_doBye.sh'</tt> function script. 
42563b

42563b

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

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

42563b

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

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

42563b

Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

42563b
change it to have a little fun.
42563b

42563b

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

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

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

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

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

42563b

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

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

42563b
centos-art locale --edit
42563b
42563b
Warning

Warning

To translate output messages in different languages,

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

42563b
42563b

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

42563b

42563b

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

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

42563b

The greet function described in this section may serve you as

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

42563b

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

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

42563b
2c3589
42563b

3.49.3 Usage

2dc146
2dc146
2c3589
42563b

3.49.3.1 Global variables

42563b
42563b

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

42563b
available for you to use inside specific functions:
42563b

42563b
42563b
<u>Variable:</u> TEXTDOMAIN
42563b
42563b
42563b

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

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

42563b
42563b
42563b
<u>Variable:</u> TEXTDOMAINDIR
42563b
42563b
42563b

Default directory used to retrieve translated messages. This value is

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

42563b
42563b
42563b
<u>Variable:</u> FUNCNAM
42563b
42563b
42563b

Define function name.

42563b

42563b

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

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

42563b

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

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

42563b

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

42563b
immediatly ends its execution.
42563b

42563b
42563b
42563b
<u>Variable:</u> FUNCDIR
42563b
42563b
42563b
42563b
42563b
42563b
<u>Variable:</u> FUNCDIRNAME
42563b
42563b
42563b
42563b
42563b
42563b
<u>Variable:</u> FUNCSCRIPT
42563b
42563b
42563b
6a8116
42563b
42563b
<u>Variable:</u> FUNCCONFIG
42563b
42563b
42563b
42563b
42563b
42563b
<u>Variable:</u> ACTIONNAM
42563b
42563b
42563b

Define action name.

42563b

42563b

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

42563b
specific function.
42563b

42563b

Action name names aare passed as second argument in

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

42563b

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

42563b
immediatly ends its execution.
42563b

42563b
42563b
42563b
<u>Variable:</u> ACTIONVAL
42563b
42563b
42563b

Define action value.

42563b

42563b

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

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

42563b
42563b
42563b
<u>Variable:</u> REGEX
42563b
42563b
42563b

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

42563b
to process.
42563b

42563b

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

42563b
files.
42563b

42563b

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

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

42563b
42563b
42563b
<u>Variable:</u> ARGUMENTS
42563b
42563b
42563b

Define optional arguments.

42563b

42563b

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

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

42563b

Optional arguments are parsed using getopt command through

42563b
the following base construction: 
42563b

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

Optional arguments provide support to command options inside

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

42563b

The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

When getopt parses ARGUMENTS, we may use short options

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

42563b

In order for getopt to parse ARGUMENTS correctly, it

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

42563b

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

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

42563b

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

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

42563b
42563b
42563b
<u>Variable:</u> EDITOR
42563b
42563b
42563b

Default text editor.

42563b

42563b

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

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

42563b

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

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

2c3589
    42563b
  • <tt>`/usr/bin/vim'</tt>
  • 42563b
  • <tt>`/usr/bin/emacs'</tt>
  • 42563b
  • <tt>`/usr/bin/nano'</tt>
  • 2c3589
    2dc146
    42563b

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

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

    42563b
    2c3589
    2c3589
    42563b

    3.49.3.2 Global functions

    6a8116
    42563b

    Function scripts stored directly under

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

    42563b
    42563b
    <u>Function:</u> cli_checkActionArguments
    42563b
    42563b
    42563b

    Validate action value (ACTIONVAL) variable.

    42563b

    42563b

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

    42563b

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

      If another value different from that specified above is passed to

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_checkFiles FILE [TYPE]
      42563b
      42563b
      42563b

      Verify file existence.

      42563b

      42563b

      cli_checkFiles receives a FILE absolute path and performs

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

      42563b
      42563b
      <samp>`d'</samp>
      42563b
      <samp>`directory'</samp>
      42563b

      Ends script execution if FILE is not a directory.

      42563b

      42563b

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

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

      42563b
      42563b
      <samp>`f'</samp>
      42563b
      <samp>`regular-file'</samp>
      42563b

      Ends script execution if FILE is not a regular file.

      42563b

      42563b
      <samp>`h'</samp>
      42563b
      <samp>`symbolic-link'</samp>
      42563b

      Ends script execution if FILE is not a symbolic link.

      42563b

      42563b
      <samp>`x'</samp>
      42563b
      <samp>`execution'</samp>
      42563b

      Ends script execution if FILE is not executable.

      42563b

      42563b
      <samp>`fh'</samp>
      42563b

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

      42563b
      symbolic link.
      42563b

      42563b
      <samp>`fd'</samp>
      42563b

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

      42563b
      directory.
      42563b

      42563b
      <samp>`isInWorkingCopy'</samp>
      42563b

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

      42563b

      42563b
      42563b
      42563b

      As default behaviour, if FILE passes all verifications,

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_commitRepoChanges [LOCATION]
      42563b
      42563b
      42563b

      Syncronize changes between repository and working copy.

      42563b

      42563b

      The cli_commitRepoChanges function brings changes from the

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

      42563b

      Previous to commit the working copy changes up to the central

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

      42563b

      If LOCATION argument is not specified, the value of

      42563b
      ACTIONVAL variable is used as reference instead.
      42563b

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

      Figure 3.3: The cli_commitRepoChanges function output.

      42563b
      42563b

      42563b

      Call the cli_commitRepoChanges function before or/and after

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_doParseArguments
      42563b
      42563b
      42563b

      Redefine arguments (ARGUMENTS) global variable using

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_doParseArgumentsReDef $@
      42563b
      42563b
      42563b

      Initialize/reset arguments (ARGUMENTS) global variable using

      42563b
      positional parameters variable ($@) as reference.
      42563b

      42563b

      When we work inside function definitions, positional parameters are

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getArguments
      42563b
      42563b
      42563b

      Initialize function name (FUNCNAM), action name

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

      42563b

      The cli_getArguments function is called from cli.sh

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

      42563b

      Once command-line positional parameters are accesible to

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

      42563b

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

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

      42563b

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

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

      42563b

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

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getFunctions
      42563b
      42563b
      42563b

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

      42563b

      42563b

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

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

      42563b

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

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

      42563b

      Inside each functionality directory, the functionalty itself is

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

      42563b

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

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

      42563b
      function prefix_doSomething {
      42563b
      42563b
          # Do something here...
      42563b
      42563b
      }
      42563b
      42563b

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

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

      42563b

      If the functionality specified in the command-line first argument

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

      42563b

      In order to keep visual consistency among function scripts, please

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

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

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

      42563b

      42563b

      The cli_getCountryCodes function outputs a list with country

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getCountryName [FILTER]
      42563b
      42563b
      42563b

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

      42563b

      42563b

      The cli_getCountryName function reads one language locale code

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

      42563b
       
      42563b
      42563b
      <u>Function:</u> cli_getCurrentLocale
      42563b
      42563b
      42563b

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

      42563b

      42563b

      The cli_getCurrentLocale function uses LANG environment

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

      42563b

      The current locale information, returned by

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

      42563b

      Locale precedence selection is quite important in order to define the

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

      42563b

      Use cli_getCurrentLocale function to know what current locale

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getFilesList [LOCATION]
      42563b
      42563b
      42563b

      Output list of files to process.

      42563b

      42563b

      The cli_getFilesList function uses LOCATION variable as

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

      42563b

      If LOCATION is not specified when cli_getFilesList

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

      42563b

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

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

      42563b

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

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

      42563b

      As result, the cli_getFilesList re-defines the value of

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

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

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

      42563b

      42563b

      cli_getLangCodes function outputs a list of language codes as

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getLangName [FILTER]
      42563b
      42563b
      42563b

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

      42563b

      42563b

      cli_getLangName function reads one language locale code in the

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getLocales
      42563b
      42563b
      42563b

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

      42563b

      42563b

      Occasionally, you use cli_getLocales function to add locale

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getRepoName NAME TYPE
      42563b
      42563b
      42563b

      Sanitate file names.

      42563b

      42563b

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

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

      42563b
      Important

      Important

      cli_getRepoName function doesn't verify file

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

      42563b
      42563b

      The NAME variable contains the file name or directory name you

      42563b
      want to sanitate.
      42563b

      42563b

      The TYPE variable specifies what type of sanitation you want to

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

      42563b
      42563b
      <samp>`d'</samp>
      42563b
      <samp>`directory'</samp>
      42563b

      Sanitate directory NAMEs.

      42563b

      42563b
      <samp>`f'</samp>
      42563b
      <samp>`regular-file'</samp>
      42563b

      Sanitate regular file NAMEs.

      42563b

      42563b
      42563b
      42563b

      Use cli_getRepoName function to sanitate file names and

      42563b
      directory names before their utilization. 
      42563b

      42563b

      Use cli_getRepoName when you need to change file name

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

      42563b

      When we change file name convenctions inside cli_getRepoName

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getRepoStatus [LOCATION]
      42563b
      42563b
      42563b

      Request repository status.

      42563b

      42563b

      This function requests the status of a LOCATION inside the

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

      42563b

      Use this function to perform verifications based a repository

      42563b
      LOCATION status.
      42563b

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getTemporalFile NAME
      42563b
      42563b
      42563b

      Output absolute path to temporal file NAME.

      42563b

      42563b

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

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

      42563b
      cli_getTemporalFile $FILE
      42563b
      42563b

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

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

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

      When you use the cli_getTemporalFile function to create

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

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

      Use the cli_getTemporalFile function whenever you need to

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_getThemeName
      42563b
      42563b
      42563b

      Output theme name.

      42563b

      42563b

      In order for cli_getThemeName function to extract theme name

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

      42563b
      42563b
      42563b
      <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
      42563b
      42563b
      42563b

      Define standard output message definition supported by

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

      42563b

      When FORMAT is not specified, cli_printMessage outputs

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

      42563b
      42563b
      <samp>`AsHeadingLine'</samp>
      42563b

      To print heading messages.

      42563b

      ----------------------------------------------------------------------
      42563b
      $MESSAGE
      42563b
      ----------------------------------------------------------------------
      42563b
      42563b
      42563b
      <samp>`AsWarningLine'</samp>
      42563b

      To print warning messages.

      42563b

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

      To print note messages.

      42563b

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

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

      42563b

      Updating        $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsRemovingLine'</samp>
      42563b

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

      42563b

      Removing        $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsCheckingLine'</samp>
      42563b

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

      42563b

      Checking        $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsCreatingLine'</samp>
      42563b

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

      42563b

      Creating        $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsSavedAsLine'</samp>
      42563b

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

      42563b

      Saved as        $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsLinkToLine'</samp>
      42563b

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

      42563b

      Linked to       $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsMovedToLine'</samp>
      42563b

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

      42563b

      Moved to        $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsTranslationLine'</samp>
      42563b

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

      42563b

      Translation     $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsConfigurationLine'</samp>
      42563b

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

      42563b

      Configuration   $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsResponseLine'</samp>
      42563b

      To print response messages on one-column format.

      42563b

      --> $MESSAGE
      42563b
      42563b
      42563b
      <samp>`AsRequestLine'</samp>
      42563b

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

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

      $MESSAGE:
      42563b
      42563b
      42563b
      <samp>`AsYesOrNoRequestLine'</samp>
      42563b

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

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

      42563b
      $MESSAGE [y/N]:
      42563b
      42563b

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

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

      42563b
      $MESSAGE [s/N]:
      42563b
      42563b

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

      42563b
      <samp>`sí'</samp> word.
      42563b

      42563b

      Definition of which confirmation word to use is set on translation

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

      42563b
      42563b
      <samp>`AsToKnowMoreLine'</samp>
      42563b

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

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

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

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

      42563b
      script termination. 
      42563b

      42563b
      42563b
      <samp>`AsRegularLine'</samp>
      42563b

      To standardize regular messages on one-column format.

      42563b

      42563b

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

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

      42563b
      42563b
      42563b

      Use cli_printMessage function whenever you need to output

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

      42563b
      Info

      Tip

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

      42563b

      trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
      42563b
      42563b
      7e35dc
      2c3589
      2c3589
      42563b

      3.49.3.3 Specific functions

      7e35dc
      42563b

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

      42563b
      available for you to use:
      42563b

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

      3.49.4 See also

      7e35dc
      42563b
      42563b
      3.48 trunk/Scripts/Bash  
      42563b
      42563b
      3.59 trunk/Scripts/Bash/Locale  
      42563b
      42563b
      4c79b5
      4c79b5
      4c79b5
      2c3589
      [ < ]
      2c3589
      [ > ]
      4c79b5
         
      4c79b5
      [ << ]
      42563b
      [ Up ]
      42563b
      [ >> ]
      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>