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

4c79b5
4c79b5
<html>
4c79b5
4c79b5
can you do inside it.
4c79b5
6c4982
Copyright C 2009, 2010 Alain Reguera Delgado. All rights
4c79b5
reserved.
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
-->
41f1ec
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>
54264c
<title>CentOS Artwork Repository: 3.35 trunk/Scripts/Bash/Functions</title>
4c79b5
54264c
<meta name="description" content="CentOS Artwork Repository: 3.35 trunk/Scripts/Bash/Functions">
54264c
<meta name="keywords" content="CentOS Artwork Repository: 3.35 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
efa7b7
[ < ]
efa7b7
[ > ]
4c79b5
   
4c79b5
[ << ]
4c79b5
[ Up ]
be6bef
[ >> ]
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
   
4c79b5
[Top]
4c79b5
[Contents]
be6bef
[Index]
4c79b5
[ ? ]
4c79b5
54264c
efa7b7
54264c

3.35 trunk/Scripts/Bash/Functions

5fb024
5fb024
efa7b7
5fb024

3.35.1 Goals

5fb024
6c4982

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

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

5fb024
efa7b7
5fb024

3.35.2 Description

5fb024
6c4982

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

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

6c4982

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

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

6c4982

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

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

6c4982

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

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

be6bef
Info

Tip

Join CentOS developers mailing list

be6bef
(centos-devel@centos.org) to share your ideas.
6c4982

5fb024
6c4982

It is also worth to know what global functions we have available, so

6c4982
advantage can be taken from them. Global functions are stored
6c4982
immediatly under <tt>`trunk/Scripts/Bash/Functions'</tt> directory in
6c4982
files begining with <samp>`cli'</samp> prefix.
6c4982

41f1ec

OK, let's begin with our greet specific functionality example.

6c4982

be6bef

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

6c4982
<samp>`hello'</samp> is not a verb, but an expression, a kind of greeting, an
41f1ec
interjection specifically. In contrast, <samp>`greet'</samp> is a verb and
6c4982
describes what we do when we say <samp>`Hello!'</samp>, <samp>`Hi!'</samp>, and so on.
be6bef

be6bef

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

6c4982

6c4982
Name: greet
6c4982
Path: trunk/Scripts/Bash/Functions/Greet
6c4982
File: trunk/Scripts/Bash/Functions/Greet/greet.sh
6c4982
41f1ec

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

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

41f1ec

Inside <tt>`centos-art.sh'</tt> script, each function definition has its

41f1ec
own top commentary, followed by one blank line, and then one function
41f1ec
defintion below it.  
6c4982

6c4982

The function top commentary contains a brief description about what

6c4982
the function does, one-line for copyright note --with your personal
6c4982
information--, the license under which the function source code is
6c4982
released --the <tt>`centos-art.sh'</tt> script is released as GPL, so do
be6bef
all its functions--, and the subversion $Id$ keyword--which
be6bef
is later expanded when we do svn propset over
41f1ec
<tt>`greet.sh'</tt> file--. 
41f1ec

41f1ec

In our greet function example, the <tt>`greet.sh'</tt> top

41f1ec
commentary would look like the following:
6c4982

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

The greet function definition would look as follows:

6c4982

6c4982
function greet {
6c4982
6c4982
    # Define global variables.
6c4982
6c4982
    # Define command-line interface.
6c4982
    greet_getActions
6c4982
6c4982
}
6c4982
41f1ec

The first definition inside greet function, are global

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

41f1ec

Later, we call greet_getActions function to define the

41f1ec
command-line interface of greet functionality. The command-line
41f1ec
interface sets what we can do with arguments passed to
41f1ec
<tt>`centos-art.sh'</tt> script, once <samp>`greet'</samp> has been specified as
41f1ec
first argument in the command-line.
6c4982

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

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

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

41f1ec

The greet specific function makes available two valid greetings

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

41f1ec

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

41f1ec
in <tt>`_getActions.sh'</tt> function scripts, no matter what specific
41f1ec
functionality you are creating. This convenction helps the user to
41f1ec
find out documentation about current functionality in use.  
41f1ec

41f1ec

The greet_doHello and greet_doBye function definitions

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

6c4982
function greet_doHello {
6c4982
6c4982
    cli_printMessage "`gettext "Hello"` $OPTIONVAL"
6c4982
6c4982
}
6c4982
be6bef

The greet_doHello function definition is stored in

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

6c4982
function greet_doBye {
6c4982
6c4982
    cli_printMessage "`gettext "Goodbye"` $OPTIONVAL"
6c4982
6c4982
}
6c4982
be6bef

The greet_doBye function definition is stored in the

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

be6bef

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

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

41f1ec

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

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

be6bef

Let's see how greet specific functionality files are organzied

41f1ec
under greet's function directory. To see file organization we
be6bef
use the tree command:
6c4982

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

To try the greet specific functionality, pass the function name

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

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

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

41f1ec
change it to have a little fun.
be6bef

be6bef

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

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

be6bef
centos-art help --edit=trunk/Scripts/Bash/Functions/Greet
be6bef
41f1ec

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

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

41f1ec
centos-art locale --edit
41f1ec
41f1ec
Warning

Warning

To translate output messages in different languages,

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

41f1ec
be6bef

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

be6bef

41f1ec

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

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

6c4982

This description may serve you as an introduction to understand how

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

be6bef

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

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

6c4982
be6bef
5fb024

3.35.3 Usage

5fb024
6c4982
be6bef
6c4982

3.35.3.1 Global variables

6c4982
6c4982

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

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

be6bef
be6bef
<u>Variable:</u> TEXTDOMAIN
be6bef
be6bef
6c4982

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

6c4982
in `initFunctions.sh' and shouldn't be changed.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> TEXTDOMAINDIR
be6bef
be6bef
6c4982

Default directory used to retrieve translated messages. This value is

6c4982
set in `initFunctions.sh' and shouldn't be changed.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> ACTION
be6bef
be6bef
6c4982

Default action passed to centos-art command as first

6c4982
argument. For example, in the command <samp>`centos-art render
6c4982
--entry=path/to/dir --filter=regex'</samp>, the action passed to
6c4982
centos-art is <samp>`render'</samp>.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> OPTIONNAM
be6bef
be6bef
6c4982

Default option name passed to centos-art command as second

6c4982
argument. For example, in the command <samp>`centos-art render
6c4982
--entry=path/to/dir --filter=regex'</samp>, the option name passed to
6c4982
centos-art as second argument is <samp>`--entry'</samp>.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> OPTIONVAL
be6bef
be6bef
6c4982

Default option value passed to centos-art command as second

6c4982
argument. For example, in the command <samp>`centos-art render
6c4982
--entry=path/to/dir --filter=regex'</samp>, the option value passed to
6c4982
centos-art as second argument is <samp>`path/to/dir'</samp>.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> REGEX
be6bef
be6bef
6c4982

Default option value passed to centos-art command as third

6c4982
argument. For example, in the command <samp>`centos-art render
6c4982
--entry=path/to/dir --filter=regex'</samp>, the option value passed to
6c4982
centos-art as second argument is <samp>`regex'</samp>. 
6c4982

6c4982

At present time, the option name passed as third argument is not

6c4982
variable, as second argument option name is. The third argument option
6c4982
name is stocked to <samp>`--filter'</samp> for whatever value it passed at
6c4982
the right side of its equal sign. Generally, third argument option
6c4982
value is used to pass regular expression patterns that modify the list
6c4982
of files to process but this is not the only feature it may serve to.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> ANSWER
be6bef
be6bef
6c4982

Default answer for questions. As most questions are to request

6c4982
confirmation about some specific action, default answer to this
6c4982
variable is negative (i.e., <samp>`No'</samp>). Default answer value takes
6c4982
place when no value is entered as response to confirmation questions
6c4982
before pressing RET key.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> TMPFILE
be6bef
be6bef
6c4982

Default location to store temporal files. This variable contains a

6c4982
value with the format <samp>`/tmp/centos-art-$$'</samp>. The <samp>`$$'</samp> expands
6c4982
to the process id of centos-art current execution.
be6bef

be6bef
be6bef
be6bef
<u>Variable:</u> EDITOR
be6bef
be6bef
6c4982

Default text editor. This variable contains the absolute path to

6c4982
<tt>`centos-art.sh'</tt> script default text editor (i.e.,
6c4982
<tt>`/usr/bin/vim'</tt>). If you want to use a different text editor set,
6c4982
and export this variable in your <tt>`~/.bash_profile'</tt> file. The
6c4982
<tt>`centos-art.sh'</tt> script recognizes one of the following text
6c4982
editors only:
6c4982

6c4982
    6c4982
  • /usr/bin/vim
  • 6c4982
  • /usr/bin/emacs
  • 6c4982
  • /usr/bin/nano
  • 6c4982
    be6bef
    6c4982
    6c4982
    be6bef
    6c4982

    3.35.3.2 Global functions

    6c4982
    6c4982

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

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

    be6bef
    be6bef
    <u>Function:</u> cli_commitRepoChanges
    be6bef
    be6bef
    be6bef

    The cli_commitRepoChanges function uses the list of files

    be6bef
    stored in the FILES variable and verifies changes inside your
    be6bef
    repository working copy, using subversion commands.  If
    be6bef
    cli_commitRepoChanges finds changes inside your working copy,
    be6bef
    it asks you for confirmation to commit them up to central repository.
    be6bef

    be6bef

    Call cli_commitRepoChanges function after functions that modify

    be6bef
    files inside your repository working copy.
    be6bef

    be6bef
    be6bef
    be6bef
    be6bef
    <u>Function:</u> cli_checkFiles FILE [TYPE [ACTION [OPTIONS]]]
    be6bef
    be6bef
    be6bef

    cli_checkFiles receives a FILE absolute path and performs

    be6bef
    verification as specified in TYPE.  
    be6bef

    be6bef

    When TYPE is not specified, cli_checkFiles verifies

    be6bef
    FILE existence, no matter what kind of file it be.  If
    41f1ec
    TYPE is specified, use one of the following values:
    be6bef

    6c4982
    be6bef
    <samp>`d'</samp>
    be6bef
    <samp>`directory'</samp>
    be6bef

    To evaluate FILE as directory.

    be6bef

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

    To evaluate FILE as regular file.

    be6bef

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

    To evaluate FILE as symbolic link.

    be6bef

    be6bef
    <samp>`fh'</samp>
    be6bef

    To evaluate FILE as regular file first and symbolic link later.

    be6bef
    When FILE is neither a regular file or a symbolic link,
    be6bef
    cli_checkFiles considers FILE as unexistent file.
    be6bef

    be6bef
    be6bef
    41f1ec

    When ACTION is not specified, cli_checkFiles function

    41f1ec
    uses <samp>`Checking'</samp> as default action message. The action message is
    41f1ec
    used on left-column as description to action verification.  It may be
    41f1ec
    cases where you need to change default action message with your own.
    41f1ec
    In those cases remember to use the "`gettext "Your message"`"
    be6bef
    construction in order for gettext to know about it. This way
    41f1ec
    your action message can be translated to other languages too.  By
    41f1ec
    default cli_checkFiles output information about FILE on
    41f1ec
    the right column. 
    be6bef

    41f1ec

    When OPTIONS is specified, default behaivour is modified as

    41f1ec
    specified in OPTIONS. The OPTIONS can take any of the
    41f1ec
    following options: 

    be6bef
    <samp>`--quiet'</samp>
    41f1ec

    The <samp>`--quiet'</samp> option supresses verification output.

    41f1ec

    cli_checkFiles $FILE 'f' '' '--quiet'
    be6bef
    if [[ $? -eq 0 ]];then
    41f1ec
        INFO="`gettext "The file exists."`"
    be6bef
    else
    41f1ec
        INFO="`gettext "The file doesn't exist."`"
    be6bef
    fi
    41f1ec

    Use <samp>`--quiet'</samp> option whenever you want to do file verifications

    41f1ec
    but don't want to output any information about it.
    41f1ec

    be6bef
    be6bef
    be6bef
    be6bef
    be6bef
    <u>Function:</u> cli_getCountryCodes [FILTER]
    be6bef
    be6bef
    be6bef

    cli_getCountryCodes function outputs a list with country codes

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

    be6bef
    be6bef
    be6bef
    <u>Function:</u> cli_getCountryNames [FILTER]
    be6bef
    be6bef
    be6bef

    cli_getCountryNames function reads one language locale code in

    be6bef
    the format LL_CC and outputs the name of its related country as in
    be6bef
    ISO3166. If filter is specified, just the country name that matches
    be6bef
    FILTER, exactly, is returned. 
    be6bef

    be6bef
     
    be6bef
    be6bef
    <u>Function:</u> cli_getCurrentLocale
    be6bef
    be6bef
    41f1ec

    cli_getCurrentLocale function uses LANG environment

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

    41f1ec

    The current locale information, returned by

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

    41f1ec

    Locale precedence selection is quite important in order to define the

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

    41f1ec

    Use cli_getCurrentLocale function to know what current locale

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

    be6bef
    be6bef
    be6bef
    <u>Function:</u> cli_getLangCodes [FILTER]
    be6bef
    be6bef
    be6bef

    cli_getLangCodes function outputs a list of language codes as

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

    be6bef
    be6bef
    41f1ec
    <u>Function:</u> cli_getLangName [FILTER]
    be6bef
    be6bef
    41f1ec

    cli_getLangName function reads one language locale code in the

    be6bef
    format LL_CC and outputs its language name as defined in ISO639
    41f1ec
    standard. If FILTER is specified, just the language name that
    41f1ec
    matches FILTER, exactly, is returned.
    be6bef

    be6bef
    be6bef
    be6bef
    <u>Function:</u> cli_getLocales
    be6bef
    be6bef
    41f1ec

    cli_getLocales defines what locale codes does

    41f1ec
    <tt>`centos-art.sh'</tt> script support.
    41f1ec

    41f1ec

    Occasionally, you use cli_getLocales function to add locale

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

    be6bef
    be6bef
    41f1ec
    <u>Function:</u> cli_getRepoName NAME TYPE
    be6bef
    be6bef
    41f1ec

    cli_getRepoName function sets file names convenctions inside

    41f1ec
    <tt>`centos-art.sh'</tt> script. File name convenctions, as set by
    41f1ec
    cli_getRepoName, are used by specific functionalities of
    41f1ec
    <tt>`centos-art.sh'</tt> script that rely on repository file system
    41f1ec
    organization to do the work they were initially conceived to do.
    41f1ec
    Consider cli_getRepoName function as a place to manage file
    41f1ec
    name convenction centrally.
    41f1ec

    41f1ec
    Warning

    Warning

    cli_getRepoName function doesn't verify file

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

    41f1ec
    41f1ec

    The NAME variable contains the file name or directory name you

    41f1ec
    want to sanitate.
    41f1ec

    41f1ec

    The TYPE variable can be one of the following values:

    41f1ec

    41f1ec
    <samp>`d'</samp>
    41f1ec
    <samp>`directory'</samp>
    41f1ec

    Sanitate directory NAMEs.

    41f1ec

    41f1ec
    <samp>`f'</samp>
    41f1ec
    <samp>`regular-file'</samp>
    41f1ec

    Sanitate regular file NAMEs.

    41f1ec

    41f1ec
    41f1ec
    41f1ec

    Use cli_getRepoName function to sanitate file names and

    41f1ec
    directory names before their utilization. 
    41f1ec

    41f1ec

    Use cli_getRepoName when you need to change file name

    41f1ec
    convenction inside <tt>`centos-art.sh'</tt> script. When changing file
    41f1ec
    name convenctions inside cli_getRepoName what you are really
    41f1ec
    changing is the way functions interpret repository file system
    41f1ec
    organization. In order to a complete file name convenction change, you
    41f1ec
    also need to change file names and directory names inside repository
    41f1ec
    file system organization, just as you did in cli_getRepoName
    41f1ec
    function. 
    41f1ec

    41f1ec
    info

    Note

    See section trunk/Scripts/Bash/Functions/Path, for more

    41f1ec
    information on how to rename files and directories massively inside
    41f1ec
    repository file system organization.
    41f1ec

    41f1ec
    be6bef
    be6bef
    be6bef
    <u>Function:</u> cli_getThemeName
    be6bef
    be6bef
    41f1ec

    cli_getThemeName function evaluates OPTIONVAL global

    41f1ec
    variable to extract theme name from it. In order for
    41f1ec
    cli_getThemeName function to extract theme name correctly, the
    41f1ec
    OPTIONVAL variable must contain a directory path under
    41f1ec
    <tt>`trunk/Identity/Themes/Motifs/'</tt> directory structure. Otherwise,
    41f1ec
    cli_getThemeName returns an empty string.
    be6bef

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

    cli_printMessage function outputs information in predifined

    be6bef
    formats. The cli_printMessage function is the standard way to
    41f1ec
    output information inside <tt>`centos-art.sh'</tt> script. 
    be6bef

    be6bef

    When FORMAT is not specified, cli_printMessage outputs

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

    be6bef
    be6bef
    <samp>`AsHeadingLine'</samp>
    be6bef

    To standardize heading messages.

    be6bef

    ----------------------------------------------------------------------
    be6bef
    $MESSAGE
    be6bef
    ----------------------------------------------------------------------
    be6bef
    6c4982
    be6bef
    <samp>`AsWarningLine'</samp>
    be6bef

    To standardize warning messages.

    be6bef

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

    To standardize note messages.

    be6bef

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

    To standardize <samp>`Updating'</samp> messages using two-columns format.

    be6bef

    Updating        $MESSAGE
    be6bef
    6c4982
    be6bef
    <samp>`AsRemovingLine'</samp>
    be6bef

    To standardize <samp>`Removing'</samp> messages using two-columns format.

    be6bef

    Removing        $MESSAGE
    be6bef
    6c4982
    be6bef
    <samp>`AsCheckingLine'</samp>
    be6bef

    To standardize <samp>`Checking'</samp> messages using two-columns format.

    be6bef

    Checking        $MESSAGE
    be6bef
    6c4982
    be6bef
    <samp>`AsCreatingLine'</samp>
    be6bef

    To standardize <samp>`Creating'</samp> messages using two-columns format.

    be6bef

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

    To standardize <samp>`Saved as'</samp> messages using two-columns format.

    be6bef

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

    To standardize <samp>`Linked to'</samp> messages using two-columns format.

    be6bef

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

    To standardize <samp>`Moved to'</samp> messages using two-columns format.

    be6bef

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

    To standardize <samp>`Translation'</samp> messages using two-columns format.

    be6bef

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

    To standardize <samp>`Configuration'</samp> messages using two-columns format.

    be6bef

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

    To standardize response messages using one-column format.

    be6bef

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

    To standardize request messages using one-column format. Request

    be6bef
    messages supress the trailing newline character from final output.
    be6bef

    $MESSAGE
    be6bef
    be6bef
    be6bef
    <samp>`AsYesOrNoRequestLine'</samp>
    be6bef

    To standardize <samp>`yes or no'</samp> request messages using one-column

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

    be6bef
    $MESSAGE [y/N]:
    be6bef
    be6bef

    When you are using <tt>`centos-art.sh'</tt> script in a locale different

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

    be6bef
    $MESSAGE [s/N]:
    be6bef
    be6bef

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

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

    be6bef

    Definition of which confirmation word to use is set on translation

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

    6c4982
    be6bef
    <samp>`AsToKnowMoreLine'</samp>
    be6bef
    be6bef

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

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

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

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

    be6bef
    script termination. 
    6c4982

    6c4982
    be6bef
    <samp>`AsRegularLine'</samp>
    be6bef

    To standardize regular messages using one-column format.

    be6bef

    be6bef

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

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

    be6bef

    Two-columns format definition is taken from

    be6bef
    <tt>`trunk/Scripts/Bash/Styles/output_forTwoColumns.awk'</tt> file.
    6c4982

    6c4982
    41f1ec

    Use cli_printMessage function whenever you need to output

    41f1ec
    information from <tt>`centos-art.sh'</tt>.
    41f1ec

    6c4982
    6c4982
    be6bef
    6c4982

    3.35.3.3 Specific functions

    6c4982
    6c4982

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

    6c4982
    available for you to use:
    6c4982

    6c4982
    be6bef
    3.36 trunk/Scripts/Bash/Functions/Help  
    38bcd9
    be6bef
    3.37 trunk/Scripts/Bash/Functions/Html  
    38bcd9
    be6bef
    3.38 trunk/Scripts/Bash/Functions/Locale  
    38bcd9
    be6bef
    3.39 trunk/Scripts/Bash/Functions/Path  
    38bcd9
    be6bef
    3.40 trunk/Scripts/Bash/Functions/Render  
    38bcd9
    be6bef
    3.41 trunk/Scripts/Bash/Functions/Render/Config  
    b17ce8
    be6bef
    3.42 trunk/Scripts/Bash/Functions/Shell  
    38bcd9
    be6bef
    3.43 trunk/Scripts/Bash/Functions/Svg  
    38bcd9
    be6bef
    3.44 trunk/Scripts/Bash/Functions/Verify  
    38bcd9
    38bcd9
    5fb024
    5fb024
    be6bef
    5fb024

    3.35.4 See also

    4c79b5
    54264c
    38bcd9
    3.34 trunk/Scripts/Bash  
    54264c
    be6bef
    3.45 trunk/Scripts/Bash/Locale  
    efa7b7
    54264c
    4c79b5
    4c79b5
    4c79b5
    be6bef
    [ < ]
    be6bef
    [ > ]
    4c79b5
       
    4c79b5
    [ << ]
    efa7b7
    [ Up ]
    be6bef
    [ >> ]
    4c79b5
    4c79b5

    4c79b5
     <font size="-1">
    41f1ec
      This document was generated on November, 4 2010 using texi2html 1.76.
    4c79b5
     </font>
    4c79b5
     
    4c79b5
    4c79b5

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