Blame Identity/Manual/repository-html/repository_2.61.html

728c6d
728c6d
<html>
728c6d
728c6d
organization, and administration of CentOS Artwork Repository.
728c6d
728c6d
Copyright C 2009-2011 Alain Reguera Delgado
728c6d
728c6d
Permission is granted to copy, distribute and/or modify this document
728c6d
under the terms of the GNU Free Documentation License, Version 1.2 or
728c6d
any later version published by the Free Software Foundation; with no
728c6d
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
728c6d
copy of the license is included in the section entitled GNU Free
728c6d
Documentation License.  
728c6d
-->
728c6d
728c6d
728c6d
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
728c6d
            Karl Berry  <karl@freefriends.org>
728c6d
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
728c6d
            and many others.
728c6d
Maintained by: Many creative people <dev@texi2html.cvshome.org>
728c6d
Send bugs and suggestions to <users@texi2html.cvshome.org>
728c6d
728c6d
-->
728c6d
<head>
728c6d
<title>CentOS Artwork Repository: 2.61 The trunk/Scripts/Functions Directory</title>
728c6d
728c6d
<meta name="description" content="CentOS Artwork Repository: 2.61 The trunk/Scripts/Functions Directory">
728c6d
<meta name="keywords" content="CentOS Artwork Repository: 2.61 The trunk/Scripts/Functions Directory">
728c6d
<meta name="resource-type" content="document">
728c6d
<meta name="distribution" content="global">
728c6d
<meta name="Generator" content="texi2html 1.76">
728c6d
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
728c6d
<style type="text/css">
728c6d
728c6d
/* CSS
728c6d
 *
728c6d
 * repository.css -- This file provides visual style for repository
728c6d
 * documentation manual in HTML format, as output by Texi2html
728c6d
 * program.
728c6d
 *
728c6d
 * Copyright (C) 2009-2011 Alain Reguera Delgado
728c6d
 *
728c6d
 * This program is free software; you can redistribute it and/or
728c6d
 * modify it under the terms of the GNU General Public License as
728c6d
 * published by the Free Software Foundation; either version 2 of the
728c6d
 * License, or (at your option) any later version.
728c6d
 * 
728c6d
 * This program is distributed in the hope that it will be useful, but
728c6d
 * WITHOUT ANY WARRANTY; without even the implied warranty of
728c6d
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
728c6d
 * General Public License for more details.
728c6d
 *
728c6d
 * You should have received a copy of the GNU General Public License
728c6d
 * along with this program; if not, write to the Free Software
728c6d
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
728c6d
 * USA.
728c6d
 * ----------------------------------------------------------------------
728c6d
 * $Id$
728c6d
 * ----------------------------------------------------------------------
728c6d
 */
728c6d
728c6d
@import url("/home/centos/artwork/trunk/Identity/Webenv/Css/base.css");
728c6d
@import url("/home/centos/artwork/trunk/Identity/Webenv/Css/base-app.css");
728c6d
728c6d
a.summary-letter {text-decoration: none}
728c6d
pre.display {font-family: serif}
728c6d
pre.format {font-family: serif}
728c6d
pre.menu-comment {font-family: serif}
728c6d
pre.menu-preformatted {font-family: serif}
728c6d
pre.smalldisplay {font-family: serif; font-size: smaller}
728c6d
pre.smallexample {font-size: smaller}
728c6d
pre.smallformat {font-family: serif; font-size: smaller}
728c6d
pre.smalllisp {font-size: smaller}
728c6d
span.sansserif {font-family:sans-serif; font-weight:normal;}
728c6d
ul.toc {list-style: none}
728c6d
-->
728c6d
</style>
728c6d
728c6d
728c6d
</head>
728c6d
728c6d
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
728c6d
728c6d
728c6d
[ < ]
728c6d
[ > ]
728c6d
   
728c6d
[Contents]
728c6d
[Index]
728c6d
[ ? ]
728c6d
728c6d
728c6d
728c6d

2.61 The <tt>`trunk/Scripts/Functions'</tt> Directory

728c6d
    728c6d
    2.61.1 Goals 
    728c6d
    2.61.2 Description 
    728c6d
    2.61.3 Usage 
    728c6d
      728c6d
      2.61.3.1 Global variables 
      728c6d
      2.61.3.2 Global functions 
      728c6d
      2.61.3.3 Specific functions 
      728c6d
      728c6d
      2.61.4 See also 
      728c6d
      728c6d
      728c6d
      728c6d
      728c6d

      2.61.1 Goals

      728c6d
      728c6d

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

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

      728c6d
      728c6d
      728c6d

      2.61.2 Description

      728c6d
      728c6d

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

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

      728c6d

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

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

      728c6d

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

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

      728c6d

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

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

      728c6d
      Info

      Tip

      Join CentOS developers mailing list

      728c6d
      centos-art@centos.org to share your ideas.
      728c6d

      728c6d
      728c6d

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

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

      728c6d

      OK, let's begin with our functionality example.

      728c6d

      728c6d

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

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

      728c6d

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

      728c6d

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

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

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

      728c6d

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

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

      728c6d

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

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

      728c6d

      In our greet function example, top commentary for

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

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

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

      728c6d
      function definition would look like the following:
      728c6d

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

      The first definition inside greet function, are global

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

      728c6d

      Later, we call greet_getActions function to define the

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

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

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

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

      728c6d

      The greet function definition makes available two valid

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

      728c6d

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

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

      728c6d

      The greet_doHello and greet_doBye function definitions

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

      728c6d
      function greet_doHello {
      728c6d
      728c6d
          cli_printMessage "`gettext "Hello"` $ACTIONVAL"
      728c6d
      728c6d
      }
      728c6d
      728c6d

      The greet_doHello function definition is stored in

      728c6d
      <tt>`greet_doHello.sh'</tt> function script. 
      728c6d

      728c6d
      function greet_doBye {
      728c6d
      728c6d
          cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
      728c6d
      728c6d
      }
      728c6d
      728c6d

      The greet_doBye function definition is stored in the

      728c6d
      <tt>`greet_doBye.sh'</tt> function script. 
      728c6d

      728c6d

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

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

      728c6d

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

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

      728c6d

      Let's see how greet specific functionality files are organzied

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

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

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

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

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

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

      728c6d
      change it to have a little fun.
      728c6d

      728c6d

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

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

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

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

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

      728c6d

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

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

      728c6d
      centos-art locale --edit
      728c6d
      728c6d
      Warning

      Warning

      To translate output messages in different languages,

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

      728c6d
      728c6d

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

      728c6d

      728c6d

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

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

      728c6d

      The greet function described in this section may serve you as

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

      728c6d

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

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

      728c6d
      728c6d
      728c6d

      2.61.3 Usage

      728c6d
        728c6d
        2.61.3.1 Global variables 
        728c6d
        2.61.3.2 Global functions 
        728c6d
        2.61.3.3 Specific functions 
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d

        2.61.3.1 Global variables

        728c6d
        728c6d

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

        728c6d
        available for you to use inside specific functions:
        728c6d

        728c6d
        728c6d
        <u>Variable:</u> TEXTDOMAIN
        728c6d
        728c6d
        728c6d

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

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

        728c6d
        728c6d
        728c6d
        <u>Variable:</u> TEXTDOMAINDIR
        728c6d
        728c6d
        728c6d

        Default directory used to retrieve translated messages. This value is

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

        728c6d
        728c6d
        728c6d
        <u>Variable:</u> FUNCNAM
        728c6d
        728c6d
        728c6d

        Define function name.

        728c6d

        728c6d

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

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

        728c6d

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

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

        728c6d

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

        728c6d
        immediatly ends its execution.
        728c6d

        728c6d
        728c6d
        728c6d
        <u>Variable:</u> FUNCDIR
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        <u>Variable:</u> FUNCDIRNAME
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        <u>Variable:</u> FUNCSCRIPT
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        <u>Variable:</u> FUNCCONFIG
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        728c6d
        <u>Variable:</u> ACTIONNAM
        728c6d
        728c6d
        728c6d

        Define action name.

        728c6d

        728c6d

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

        728c6d
        specific function.
        728c6d

        728c6d

        Action name names aare passed as second argument in

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

        728c6d

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

        728c6d
        immediatly ends its execution.
        728c6d

        728c6d
        728c6d
        728c6d
        <u>Variable:</u> ACTIONVAL
        728c6d
        728c6d
        728c6d

        Define action value.

        728c6d

        728c6d

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

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

        728c6d
        728c6d
        728c6d
        <u>Variable:</u> REGEX
        728c6d
        728c6d
        728c6d

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

        728c6d
        to process.
        728c6d

        728c6d

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

        728c6d
        files.
        728c6d

        728c6d

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

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

        728c6d
        728c6d
        728c6d
        <u>Variable:</u> ARGUMENTS
        728c6d
        728c6d
        728c6d

        Define optional arguments.

        728c6d

        728c6d

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

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

        728c6d

        Optional arguments are parsed using getopt command through

        728c6d
        the following base construction: 
        728c6d

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

        Optional arguments provide support to command options inside

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

        728c6d

        The ARGUMENTS variable is used to store arguments passed from

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

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

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

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

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

        When getopt parses ARGUMENTS, we may use short options

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

        728c6d

        In order for getopt to parse ARGUMENTS correctly, it

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

        728c6d

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

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

        728c6d

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

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

        728c6d
        728c6d
        728c6d
        <u>Variable:</u> EDITOR
        728c6d
        728c6d
        728c6d

        Default text editor.

        728c6d

        728c6d

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

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

        728c6d

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

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

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

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

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

          728c6d
          728c6d
          728c6d
          728c6d

          2.61.3.2 Global functions

          728c6d
          728c6d

          Function scripts stored directly under

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

          728c6d
          728c6d
          <u>Function:</u> cli_checkActionArguments
          728c6d
          728c6d
          728c6d

          Validate action value (ACTIONVAL) variable.

          728c6d

          728c6d

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

          728c6d

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

            If another value different from that specified above is passed to

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_checkFiles FILE [TYPE]
            728c6d
            728c6d
            728c6d

            Verify file existence.

            728c6d

            728c6d

            cli_checkFiles receives a FILE absolute path and performs

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

            728c6d
            728c6d
            <samp>`d'</samp>
            728c6d
            <samp>`directory'</samp>
            728c6d

            Ends script execution if FILE is not a directory.

            728c6d

            728c6d

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

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

            728c6d
            728c6d
            <samp>`f'</samp>
            728c6d
            <samp>`regular-file'</samp>
            728c6d

            Ends script execution if FILE is not a regular file.

            728c6d

            728c6d
            <samp>`h'</samp>
            728c6d
            <samp>`symbolic-link'</samp>
            728c6d

            Ends script execution if FILE is not a symbolic link.

            728c6d

            728c6d
            <samp>`x'</samp>
            728c6d
            <samp>`execution'</samp>
            728c6d

            Ends script execution if FILE is not executable.

            728c6d

            728c6d
            <samp>`fh'</samp>
            728c6d

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

            728c6d
            symbolic link.
            728c6d

            728c6d
            <samp>`fd'</samp>
            728c6d

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

            728c6d
            directory.
            728c6d

            728c6d
            <samp>`isInWorkingCopy'</samp>
            728c6d

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

            728c6d

            728c6d
            728c6d
            728c6d

            As default behaviour, if FILE passes all verifications,

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_commitRepoChanges [LOCATION]
            728c6d
            728c6d
            728c6d

            Syncronize changes between repository and working copy.

            728c6d

            728c6d

            The cli_commitRepoChanges function brings changes from the

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

            728c6d

            Previous to commit the working copy changes up to the central

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

            728c6d

            If LOCATION argument is not specified, the value of

            728c6d
            ACTIONVAL variable is used as reference instead.
            728c6d

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

            Figure 2.3: The cli_commitRepoChanges function output.

            728c6d
            728c6d

            728c6d

            Call the cli_commitRepoChanges function before or/and after

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_doParseArguments
            728c6d
            728c6d
            728c6d

            Redefine arguments (ARGUMENTS) global variable using

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_doParseArgumentsReDef $@
            728c6d
            728c6d
            728c6d

            Initialize/reset arguments (ARGUMENTS) global variable using

            728c6d
            positional parameters variable ($@) as reference.
            728c6d

            728c6d

            When we work inside function definitions, positional parameters are

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getArguments
            728c6d
            728c6d
            728c6d

            Initialize function name (FUNCNAM), action name

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

            728c6d

            The cli_getArguments function is called from cli.sh

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

            728c6d

            Once command-line positional parameters are accesible to

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

            728c6d

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

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

            728c6d

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

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

            728c6d

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

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getFunctions
            728c6d
            728c6d
            728c6d

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

            728c6d

            728c6d

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

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

            728c6d

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

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

            728c6d

            Inside each functionality directory, the functionalty itself is

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

            728c6d

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

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

            728c6d
            function prefix_doSomething {
            728c6d
            728c6d
                # Do something here...
            728c6d
            728c6d
            }
            728c6d
            728c6d

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

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

            728c6d

            If the functionality specified in the command-line first argument

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

            728c6d

            In order to keep visual consistency among function scripts, please

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

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

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

            728c6d

            728c6d

            The cli_getCountryCodes function outputs a list with country

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getCountryName [FILTER]
            728c6d
            728c6d
            728c6d

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

            728c6d

            728c6d

            The cli_getCountryName function reads one language locale code

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

            728c6d
             
            728c6d
            728c6d
            <u>Function:</u> cli_getCurrentLocale
            728c6d
            728c6d
            728c6d

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

            728c6d

            728c6d

            The cli_getCurrentLocale function uses LANG environment

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

            728c6d

            The current locale information, returned by

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

            728c6d

            Locale precedence selection is quite important in order to define the

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

            728c6d

            Use cli_getCurrentLocale function to know what current locale

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getFilesList [LOCATION]
            728c6d
            728c6d
            728c6d

            Output list of files to process.

            728c6d

            728c6d

            The cli_getFilesList function uses LOCATION variable as

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

            728c6d

            If LOCATION is not specified when cli_getFilesList

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

            728c6d

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

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

            728c6d

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

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

            728c6d

            As result, the cli_getFilesList re-defines the value of

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

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

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

            728c6d

            728c6d

            cli_getLangCodes function outputs a list of language codes as

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getLangName [FILTER]
            728c6d
            728c6d
            728c6d

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

            728c6d

            728c6d

            cli_getLangName function reads one language locale code in the

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getLocales
            728c6d
            728c6d
            728c6d

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

            728c6d

            728c6d

            Occasionally, you use cli_getLocales function to add locale

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getRepoName NAME TYPE
            728c6d
            728c6d
            728c6d

            Sanitate file names.

            728c6d

            728c6d

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

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

            728c6d
            Important

            Important

            cli_getRepoName function doesn't verify file

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

            728c6d
            728c6d

            The NAME variable contains the file name or directory name you

            728c6d
            want to sanitate.
            728c6d

            728c6d

            The TYPE variable specifies what type of sanitation you want to

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

            728c6d
            728c6d
            <samp>`d'</samp>
            728c6d
            <samp>`directory'</samp>
            728c6d

            Sanitate directory NAMEs.

            728c6d

            728c6d
            <samp>`f'</samp>
            728c6d
            <samp>`regular-file'</samp>
            728c6d

            Sanitate regular file NAMEs.

            728c6d

            728c6d
            728c6d
            728c6d

            Use cli_getRepoName function to sanitate file names and

            728c6d
            directory names before their utilization. 
            728c6d

            728c6d

            Use cli_getRepoName when you need to change file name

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

            728c6d

            When we change file name convenctions inside cli_getRepoName

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getRepoStatus [LOCATION]
            728c6d
            728c6d
            728c6d

            Request repository status.

            728c6d

            728c6d

            This function requests the status of a LOCATION inside the

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

            728c6d

            Use this function to perform verifications based a repository

            728c6d
            LOCATION status.
            728c6d

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getTemporalFile NAME
            728c6d
            728c6d
            728c6d

            Output absolute path to temporal file NAME.

            728c6d

            728c6d

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

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

            728c6d
            cli_getTemporalFile $FILE
            728c6d
            728c6d

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

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

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

            When you use the cli_getTemporalFile function to create

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

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

            Use the cli_getTemporalFile function whenever you need to

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_getThemeName
            728c6d
            728c6d
            728c6d

            Output theme name.

            728c6d

            728c6d

            In order for cli_getThemeName function to extract theme name

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

            728c6d
            728c6d
            728c6d
            <u>Function:</u> cli_printMessage MESSAGE [FORMAT]
            728c6d
            728c6d
            728c6d

            Define standard output message definition supported by

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

            728c6d

            When FORMAT is not specified, cli_printMessage outputs

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

            728c6d
            728c6d
            <samp>`AsHeadingLine'</samp>
            728c6d

            To print heading messages.

            728c6d

            ----------------------------------------------------------------------
            728c6d
            $MESSAGE
            728c6d
            ----------------------------------------------------------------------
            728c6d
            728c6d
            728c6d
            <samp>`AsWarningLine'</samp>
            728c6d

            To print warning messages.

            728c6d

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

            To print note messages.

            728c6d

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

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

            728c6d

            Updating        $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsRemovingLine'</samp>
            728c6d

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

            728c6d

            Removing        $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsCheckingLine'</samp>
            728c6d

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

            728c6d

            Checking        $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsCreatingLine'</samp>
            728c6d

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

            728c6d

            Creating        $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsSavedAsLine'</samp>
            728c6d

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

            728c6d

            Saved as        $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsLinkToLine'</samp>
            728c6d

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

            728c6d

            Linked to       $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsMovedToLine'</samp>
            728c6d

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

            728c6d

            Moved to        $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsTranslationLine'</samp>
            728c6d

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

            728c6d

            Translation     $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsConfigurationLine'</samp>
            728c6d

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

            728c6d

            Configuration   $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsResponseLine'</samp>
            728c6d

            To print response messages on one-column format.

            728c6d

            --> $MESSAGE
            728c6d
            728c6d
            728c6d
            <samp>`AsRequestLine'</samp>
            728c6d

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

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

            $MESSAGE:
            728c6d
            728c6d
            728c6d
            <samp>`AsYesOrNoRequestLine'</samp>
            728c6d

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

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

            728c6d
            $MESSAGE [y/N]:
            728c6d
            728c6d

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

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

            728c6d
            $MESSAGE [s/N]:
            728c6d
            728c6d

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

            728c6d
            <samp>`sí'</samp> word.
            728c6d

            728c6d

            Definition of which confirmation word to use is set on translation

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

            728c6d
            728c6d
            <samp>`AsToKnowMoreLine'</samp>
            728c6d

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

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

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

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

            728c6d
            script termination. 
            728c6d

            728c6d
            728c6d
            <samp>`AsRegularLine'</samp>
            728c6d

            To standardize regular messages on one-column format.

            728c6d

            728c6d

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

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

            728c6d
            728c6d
            728c6d

            Use cli_printMessage function whenever you need to output

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

            728c6d
            Info

            Tip

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

            728c6d

            trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
            728c6d
            728c6d
            728c6d
            728c6d
            728c6d
            728c6d

            2.61.3.3 Specific functions

            728c6d
            728c6d

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

            728c6d
            available for you to use:
            728c6d

            728c6d
            728c6d
            728c6d
            728c6d

            2.61.4 See also

            728c6d
            728c6d
            728c6d
            728c6d
            728c6d
            [Contents]
            728c6d
            [Index]
            728c6d
            [ ? ]
            728c6d
            728c6d

            728c6d
             <font size="-1">
            728c6d
              This document was generated on March, 30 2011 using texi2html 1.76.
            728c6d
             </font>
            728c6d
             
            728c6d
            728c6d

            728c6d
            </body>
            728c6d
            </html>