|
|
ee1f37 |
|
|
|
ee1f37 |
<html>
|
|
|
d1db00 |
|
|
|
d1db00 |
organization, and administration of CentOS Artwork Repository.
|
|
|
d1db00 |
|
|
|
d1db00 |
Copyright C 2009-2011 Alain Reguera Delgado
|
|
|
ee1f37 |
|
|
|
ee1f37 |
Permission is granted to copy, distribute and/or modify this document
|
|
|
ee1f37 |
under the terms of the GNU Free Documentation License, Version 1.2 or
|
|
|
ee1f37 |
any later version published by the Free Software Foundation; with no
|
|
|
ee1f37 |
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
|
|
|
ee1f37 |
copy of the license is included in the section entitled GNU Free
|
|
|
ee1f37 |
Documentation License.
|
|
|
ee1f37 |
-->
|
|
|
afcfb5 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
|
|
|
ee1f37 |
Karl Berry <karl@freefriends.org>
|
|
|
ee1f37 |
Olaf Bachmann <obachman@mathematik.uni-kl.de>
|
|
|
ee1f37 |
and many others.
|
|
|
ee1f37 |
Maintained by: Many creative people <dev@texi2html.cvshome.org>
|
|
|
ee1f37 |
Send bugs and suggestions to <users@texi2html.cvshome.org>
|
|
|
ee1f37 |
|
|
|
ee1f37 |
-->
|
|
|
ee1f37 |
<head>
|
|
|
671838 |
<title>CentOS Artwork Repository: 2.52 The trunk/Scripts/Bash/Cli/Functions Directory</title>
|
|
|
ee1f37 |
|
|
|
671838 |
<meta name="description" content="CentOS Artwork Repository: 2.52 The trunk/Scripts/Bash/Cli/Functions Directory">
|
|
|
671838 |
<meta name="keywords" content="CentOS Artwork Repository: 2.52 The trunk/Scripts/Bash/Cli/Functions Directory">
|
|
|
ee1f37 |
<meta name="resource-type" content="document">
|
|
|
ee1f37 |
<meta name="distribution" content="global">
|
|
|
ee1f37 |
<meta name="Generator" content="texi2html 1.76">
|
|
|
ee1f37 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
|
ee1f37 |
<style type="text/css">
|
|
|
ee1f37 |
|
|
|
ee1f37 |
@import "/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/common.css";
|
|
|
ee1f37 |
|
|
|
ee1f37 |
a.summary-letter {text-decoration: none}
|
|
|
ee1f37 |
pre.display {font-family: serif}
|
|
|
ee1f37 |
pre.format {font-family: serif}
|
|
|
ee1f37 |
pre.menu-comment {font-family: serif}
|
|
|
ee1f37 |
pre.menu-preformatted {font-family: serif}
|
|
|
ee1f37 |
pre.smalldisplay {font-family: serif; font-size: smaller}
|
|
|
ee1f37 |
pre.smallexample {font-size: smaller}
|
|
|
ee1f37 |
pre.smallformat {font-family: serif; font-size: smaller}
|
|
|
ee1f37 |
pre.smalllisp {font-size: smaller}
|
|
|
ee1f37 |
span.sansserif {font-family:sans-serif; font-weight:normal;}
|
|
|
ee1f37 |
ul.toc {list-style: none}
|
|
|
ee1f37 |
-->
|
|
|
ee1f37 |
</style>
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
</head>
|
|
|
ee1f37 |
|
|
|
ee1f37 |
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
671838 |
[ < ]
|
|
|
671838 |
[ > ]
|
|
|
ee1f37 |
|
|
|
671838 |
[ << ]
|
|
|
671838 |
[ Up ]
|
|
|
671838 |
[ >> ]
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
56a476 |
[Top]
|
|
|
56a476 |
[Contents]
|
|
|
671838 |
[Index]
|
|
|
56a476 |
[ ? ]
|
|
|
ee1f37 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.52 The <tt>`trunk/Scripts/Bash/Cli/Functions'</tt> Directory
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
671838 |
|
|
|
671838 |
2.52.1 Goals
|
|
|
671838 |
|
|
|
671838 |
The <tt>`trunk/Scripts/Bash/Functions'</tt> directory exists to organize
|
|
|
671838 |
<tt>`centos-art.sh'</tt> specific functionalities.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.52.2 Description
|
|
|
671838 |
|
|
|
671838 |
The specific functions of <tt>`centos-art.sh'</tt> script are designed
|
|
|
671838 |
with "Software Toolbox" philosophy (see (coreutils.info)Toolbox introduction) in mind: each program "should do one
|
|
|
671838 |
thing well". Inside <tt>`centos-art.sh'</tt> script, each specific
|
|
|
671838 |
functionality is considered a program that should do one thing well.
|
|
|
671838 |
Of course, if you find that they still don't do it, feel free to
|
|
|
671838 |
improve them in order for them to do so.
|
|
|
671838 |
|
|
|
671838 |
The specific functions of <tt>`centos-art.sh'</tt> script are organized
|
|
|
671838 |
inside specific directories under <tt>`trunk/Scripts/Bash/Functions'</tt>
|
|
|
671838 |
location. Each specific function directory should be named as the
|
|
|
671838 |
function it represents, with the first letter in uppercase. For
|
|
|
671838 |
example, if the function name is render , the specific function
|
|
|
671838 |
directory for it would be <samp>`trunk/Scripts/Bash/Functions/Render'</samp>.
|
|
|
671838 |
|
|
|
671838 |
To better understand how specific functions of <tt>`centos-art.sh'</tt>
|
|
|
671838 |
script are designed, lets create one function which only goal is to
|
|
|
671838 |
output different kind of greetings to your screen.
|
|
|
671838 |
|
|
|
671838 |
When we create specific functions for <tt>`centos-art.sh'</tt> script it
|
|
|
671838 |
is crucial to know what these functions will do exactly and if there
|
|
|
671838 |
is any function that already does what we intend to do. If there is no
|
|
|
671838 |
one, it is good time to create them then. Otherwise, if
|
|
|
671838 |
functionalities already available don't do what you exactly expect,
|
|
|
671838 |
contact their authors and work together to improve them.
|
|
|
671838 |
|
|
|
671838 |
Tip Join CentOS developers mailing list
|
|
|
671838 |
centos-art@centos.org to share your ideas.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
It is also worth to know what global functions and variables do we
|
|
|
671838 |
have available inside <tt>`centos-art.sh'</tt> script, so advantage can be
|
|
|
671838 |
taken from them. Global variables are defined inside global function
|
|
|
671838 |
scripts. Global functions scripts are stored immediatly under
|
|
|
671838 |
<tt>`trunk/Scripts/Bash/Functions'</tt> directory, in files begining with
|
|
|
671838 |
<samp>`cli'</samp> prefix.
|
|
|
671838 |
|
|
|
671838 |
OK, let's begin with our functionality example.
|
|
|
671838 |
|
|
|
671838 |
What function name do we use? Well, lets use greet . Note that
|
|
|
671838 |
<samp>`hello'</samp> word is not a verb; but an expression, a kind of
|
|
|
671838 |
greeting, an interjection specifically. In contrast, <samp>`greet'</samp> is a
|
|
|
671838 |
verb and describes what we do when we say <samp>`Hello!'</samp>, <samp>`Hi!'</samp>,
|
|
|
671838 |
and similar expressions.
|
|
|
671838 |
|
|
|
671838 |
So far, we've gathered the following function information:
|
|
|
671838 |
|
|
|
671838 |
Name: greet
|
|
|
671838 |
Path: trunk/Scripts/Bash/Functions/Greet
|
|
|
671838 |
File: trunk/Scripts/Bash/Functions/Greet/greet.sh
|
|
|
671838 |
|
|
|
671838 |
The <tt>`greet.sh'</tt> function script is the first file
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script loads when the <samp>`greet'</samp> functionality
|
|
|
671838 |
is called using commands like <samp>`centos-art greet --hello='World''</samp>.
|
|
|
671838 |
The <tt>`greet.sh'</tt> function script contains the greet function
|
|
|
671838 |
definition.
|
|
|
671838 |
|
|
|
671838 |
Inside <tt>`centos-art.sh'</tt> script, as convenction, each function
|
|
|
671838 |
script has one top commentary, followed by one blank line, and then
|
|
|
671838 |
one function defintion below it only.
|
|
|
671838 |
|
|
|
671838 |
Inside <tt>`centos-art.sh'</tt> script functions, top commentaries have
|
|
|
671838 |
the following components: the functionality description, one-line for
|
|
|
671838 |
copyright note with your personal information, the license under
|
|
|
671838 |
which the function source code is released --the <tt>`centos-art.sh'</tt>
|
|
|
671838 |
script is released as GPL, so do all its functions--, the $Id$
|
|
|
671838 |
keyword of Subversion is later expanded by svn propset
|
|
|
671838 |
command.
|
|
|
671838 |
|
|
|
671838 |
In our greet function example, top commentary for
|
|
|
671838 |
<tt>`greet.sh'</tt> function script would look like the following:
|
|
|
671838 |
|
|
|
671838 |
#!/bin/bash
|
|
|
671838 |
#
|
|
|
671838 |
# greet.sh -- This function outputs different kind of greetings to
|
|
|
671838 |
# your screen. Use this function to understand how centos-art.sh
|
|
|
671838 |
# script specific functionalities work.
|
|
|
671838 |
#
|
|
|
671838 |
# Copyright (C) YEAR YOURFULLNAME
|
|
|
671838 |
#
|
|
|
671838 |
# This program is free software; you can redistribute it and/or modify
|
|
|
671838 |
# it under the terms of the GNU General Public License as published by
|
|
|
671838 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
671838 |
# (at your option) any later version.
|
|
|
671838 |
#
|
|
|
671838 |
# This program is distributed in the hope that it will be useful, but
|
|
|
671838 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
671838 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
671838 |
# General Public License for more details.
|
|
|
671838 |
#
|
|
|
671838 |
# You should have received a copy of the GNU General Public License
|
|
|
671838 |
# along with this program; if not, write to the Free Software
|
|
|
671838 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
671838 |
# USA.
|
|
|
671838 |
#
|
|
|
671838 |
# ----------------------------------------------------------------------
|
|
|
671838 |
# $Id$
|
|
|
671838 |
# ----------------------------------------------------------------------
|
|
|
671838 |
|
|
|
671838 |
After top commentary, separated by one blank line, the greet
|
|
|
671838 |
function definition would look like the following:
|
|
|
671838 |
|
|
|
671838 |
function greet {
|
|
|
671838 |
|
|
|
671838 |
# Define global variables.
|
|
|
671838 |
|
|
|
671838 |
# Define command-line interface.
|
|
|
671838 |
greet_getActions
|
|
|
671838 |
|
|
|
671838 |
}
|
|
|
671838 |
|
|
|
671838 |
The first definition inside greet function, are global
|
|
|
671838 |
variables that will be available along greet function execution
|
|
|
671838 |
environment. This time we didn't use global variable definitions for
|
|
|
671838 |
greet function execution environment, so we left that section
|
|
|
671838 |
empty.
|
|
|
671838 |
|
|
|
671838 |
Later, we call greet_getActions function to define the
|
|
|
671838 |
command-line interface of greet functionality. The command-line
|
|
|
671838 |
interface of greet functionality defines what and how actions
|
|
|
671838 |
are performed, based on arguments combination passed to
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
function greet_getActions {
|
|
|
671838 |
|
|
|
671838 |
case "$ACTIONNAM" in
|
|
|
671838 |
|
|
|
671838 |
--hello )
|
|
|
671838 |
greet_doHello
|
|
|
671838 |
;;
|
|
|
671838 |
|
|
|
671838 |
--bye )
|
|
|
671838 |
greet_doBye
|
|
|
671838 |
;;
|
|
|
671838 |
|
|
|
671838 |
* )
|
|
|
671838 |
cli_printMessage "`gettext "The option provided is not valid."`"
|
|
|
671838 |
cli_printMessage "$(caller)" 'AsToKnowMoreLine'
|
|
|
671838 |
|
|
|
671838 |
esac
|
|
|
671838 |
|
|
|
671838 |
}
|
|
|
671838 |
|
|
|
671838 |
The ACTIONNAM global variable is defined in <tt>`cli.sh'</tt>
|
|
|
671838 |
function script and contains the value passed before the equal sign
|
|
|
671838 |
(i.e., <samp>`='</samp>) in the second command-line argument of
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script. For example, if the second command-line
|
|
|
671838 |
argument is <samp>`--hello='World''</samp>, the value of ACTIONNAM
|
|
|
671838 |
variable would be <samp>`--hello'</samp>. Using this configuration let us
|
|
|
671838 |
deside which action to perform based on the action name passed to
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script as second argument.
|
|
|
671838 |
|
|
|
671838 |
The greet function definition makes available two valid
|
|
|
671838 |
greetings through <samp>`--hello'</samp> and <samp>`--bye'</samp> options. If no
|
|
|
671838 |
one of them is provided as second command-line argument, the <samp>`*'</samp>
|
|
|
671838 |
case is evaluated instead.
|
|
|
671838 |
|
|
|
671838 |
The <samp>`*'</samp> case and its two lines further on should always be
|
|
|
671838 |
present in <tt>`_getActions.sh'</tt> function scripts, no matter what
|
|
|
671838 |
specific functionality you are creating. This convenction helps the
|
|
|
671838 |
user to find out documentation about current functionality in use,
|
|
|
671838 |
when no valid action is provided.
|
|
|
671838 |
|
|
|
671838 |
The greet_doHello and greet_doBye function definitions
|
|
|
671838 |
are the core of greet specific functionality. In such function
|
|
|
671838 |
definitions we set what our greet function really does: to
|
|
|
671838 |
output different kinds of greetings.
|
|
|
671838 |
|
|
|
671838 |
function greet_doHello {
|
|
|
671838 |
|
|
|
671838 |
cli_printMessage "`gettext "Hello"` $ACTIONVAL"
|
|
|
671838 |
|
|
|
671838 |
}
|
|
|
671838 |
|
|
|
671838 |
The greet_doHello function definition is stored in
|
|
|
671838 |
<tt>`greet_doHello.sh'</tt> function script.
|
|
|
671838 |
|
|
|
671838 |
function greet_doBye {
|
|
|
671838 |
|
|
|
671838 |
cli_printMessage "`gettext "Goodbye"` $ACTIONVAL"
|
|
|
671838 |
|
|
|
671838 |
}
|
|
|
671838 |
|
|
|
671838 |
The greet_doBye function definition is stored in the
|
|
|
671838 |
<tt>`greet_doBye.sh'</tt> function script.
|
|
|
671838 |
|
|
|
671838 |
Both <tt>`greet_doHello.sh'</tt> and <tt>`greet_doBye.sh'</tt> function
|
|
|
671838 |
scripts are stored inside greet function directory path (i.e.
|
|
|
671838 |
<tt>`trunk/Scripts/Bash/Functions/Greet'</tt>).
|
|
|
671838 |
|
|
|
671838 |
The ACTIONVAL global variable is defined in <tt>`cli.sh'</tt>
|
|
|
671838 |
function script and contains the value passed after the equal sign
|
|
|
671838 |
(i.e., <samp>`='</samp>) in the second command-line argument of
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script. For example, if the second command-line
|
|
|
671838 |
argument is <samp>`--hello='World''</samp>, the value of ACTIONVAL
|
|
|
671838 |
variable would be <samp>`World'</samp> without quotes.
|
|
|
671838 |
|
|
|
671838 |
Let's see how greet specific functionality files are organzied
|
|
|
671838 |
under greet function directory. To see file organization we use
|
|
|
671838 |
the tree command:
|
|
|
671838 |
|
|
|
671838 |
trunk/Scripts/Bash/Functions/Greet
|
|
|
671838 |
|-- greet_doBye.sh
|
|
|
671838 |
|-- greet_doHello.sh
|
|
|
671838 |
|-- greet_getActions.sh
|
|
|
671838 |
`-- greet.sh
|
|
|
671838 |
|
|
|
671838 |
To try the greet specific functionality we've just created,
|
|
|
671838 |
pass the function name (i.e., <samp>`greet'</samp>) as first argument to
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script, and any of the valid options as second
|
|
|
671838 |
argument. Some examples are illustrated below:
|
|
|
671838 |
|
|
|
671838 |
[centos@projects ~]$ centos-art greet --hello='World'
|
|
|
671838 |
Hello World
|
|
|
671838 |
[centos@projects ~]$ centos-art greet --bye='World'
|
|
|
671838 |
Goodbye World
|
|
|
671838 |
[centos@projects ~]$
|
|
|
671838 |
|
|
|
671838 |
The word <samp>`World'</samp> in the examples above can be anything. In fact,
|
|
|
671838 |
change it to have a little fun.
|
|
|
671838 |
|
|
|
671838 |
Now that we have a specific function that works as we expect, it is
|
|
|
671838 |
time to document it. To document greet specific functionality,
|
|
|
671838 |
we use its directory path and the manual functionality
|
|
|
671838 |
(-- Removed(pxref:trunk Scripts Bash Functions Manual) --) of <tt>`centos-art.sh'</tt>
|
|
|
671838 |
script, just as the following command illustrates:
|
|
|
671838 |
|
|
|
671838 |
centos-art manual --edit=trunk/Scripts/Bash/Functions/Greet
|
|
|
671838 |
|
|
|
671838 |
To have a well documented function helps user to understand how your
|
|
|
671838 |
function really works, and how it should be used. When no valid
|
|
|
671838 |
action is passed to a function, the <tt>`centos-art.sh'</tt> script uses
|
|
|
671838 |
the function documentation entry as vehicle to communicate which the
|
|
|
671838 |
valid functions are. When no documentation entry exists for a
|
|
|
671838 |
function, the <tt>`centos-art.sh'</tt> script informs that no
|
|
|
671838 |
documentation entry exists for such function and requests user to
|
|
|
671838 |
create it right at that time.
|
|
|
671838 |
|
|
|
671838 |
Now that we have documented our function, it is time to translate its
|
|
|
671838 |
output messages to different languages. To translate specific
|
|
|
671838 |
functionality output messages to different languages we use the
|
|
|
671838 |
locale functionality (-- Removed(pxref:trunk Scripts Bash Functions
|
|
|
671838 |
Locale) --) of <tt>`centos-art.sh'</tt> script, just as the following command
|
|
|
671838 |
illustrates:
|
|
|
671838 |
|
|
|
671838 |
centos-art locale --edit
|
|
|
671838 |
|
|
|
671838 |
Warning To translate output messages in different languages,
|
|
|
671838 |
your system locale information --as in LANG environment
|
|
|
671838 |
variable-- must be set to that locale you want to produce translated
|
|
|
671838 |
messages for. For example, if you want to produce translated messages
|
|
|
671838 |
for Spanish language, your system locale information must be set to
|
|
|
671838 |
<samp>`es_ES.UTF-8'</samp>, or similar, first.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Well, it seems that our example is rather complete by now.
|
|
|
671838 |
|
|
|
671838 |
In greet function example we've described so far, we only use
|
|
|
671838 |
cli_printMessage global function in action specific function
|
|
|
671838 |
definitions in order to print messages, but more interesting things
|
|
|
671838 |
can be achieved inside action specific function definitions. For
|
|
|
671838 |
example, if you pass a directory path as action value in second
|
|
|
671838 |
argument, you could retrive a list of files from therein, and process
|
|
|
671838 |
them. If the list of files turns too long or you just want to control
|
|
|
671838 |
which files to process, you could add the third argument in the form
|
|
|
671838 |
<samp>`--filter='regex''</samp> and reduce the amount of files to process
|
|
|
671838 |
using a regular expression pattern.
|
|
|
671838 |
|
|
|
671838 |
The greet function described in this section may serve you as
|
|
|
671838 |
an introduction to understand how specific functionalities work inside
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script. With some of luck this introduction will
|
|
|
671838 |
also serve you as motivation to create your own <tt>`centos-art.sh'</tt>
|
|
|
671838 |
script specific functionalities.
|
|
|
671838 |
|
|
|
671838 |
By the way, the greet functionality doesn't exist inside
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script yet. Would you like to create it?
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.52.3 Usage
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.52.3.1 Global variables
|
|
|
671838 |
|
|
|
671838 |
The following global variables of <tt>`centos-art.sh'</tt> script, are
|
|
|
671838 |
available for you to use inside specific functions:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> TEXTDOMAIN
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Default domain used to retrieve translated messages. This value is set
|
|
|
671838 |
in <tt>`initFunctions.sh'</tt> and shouldn't be changed.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> TEXTDOMAINDIR
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Default directory used to retrieve translated messages. This value is
|
|
|
671838 |
set in <tt>`initFunctions.sh'</tt> and shouldn't be changed.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> FUNCNAM
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Define function name.
|
|
|
671838 |
|
|
|
671838 |
Function names associate sets of actions. There is one set of actions
|
|
|
671838 |
for each unique function name inside <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
Dunction names are passed as first argument in <tt>`centos-art.sh'</tt>
|
|
|
671838 |
command-line interface. For example, in the command <samp>`centos-art
|
|
|
671838 |
render --entry=path/to/dir --filter=regex'</samp>, the ACTION passed to
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script is <samp>`render'</samp>.
|
|
|
671838 |
|
|
|
671838 |
When first argument is not provided, the <tt>`centos-art.sh'</tt> script
|
|
|
671838 |
immediatly ends its execution.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> FUNCDIR
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> FUNCDIRNAME
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> FUNCSCRIPT
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> FUNCCONFIG
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> ACTIONNAM
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Define action name.
|
|
|
671838 |
|
|
|
671838 |
Each action name identifies an specific action to perform, inside an
|
|
|
671838 |
specific function.
|
|
|
671838 |
|
|
|
671838 |
Action name names aare passed as second argument in
|
|
|
671838 |
<tt>`centos-art.sh'</tt> command-line interface. For example, in the
|
|
|
671838 |
command <samp>`centos-art render --entry=path/to/dir --filter=regex'</samp>,
|
|
|
671838 |
the ACTIONNAM passed to <tt>`centos-art.sh'</tt> script is
|
|
|
671838 |
<samp>`--entry'</samp>.
|
|
|
671838 |
|
|
|
671838 |
When second argument is not provided, the <tt>`centos-art.sh'</tt> script
|
|
|
671838 |
immediatly ends its execution.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> ACTIONVAL
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Define action value.
|
|
|
671838 |
|
|
|
671838 |
Action values are associated to just one action name. Action values
|
|
|
671838 |
contain the working copy entry over which its associated action will be
|
|
|
671838 |
performed in. Working copy entries can be files or directories inside
|
|
|
671838 |
the working copy.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> REGEX
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Define regular expression used as pattern to build the list of files
|
|
|
671838 |
to process.
|
|
|
671838 |
|
|
|
671838 |
By default, REGEX variable is set to .+ to match all
|
|
|
671838 |
files.
|
|
|
671838 |
|
|
|
671838 |
Functions that need to build a list of files to process use the option
|
|
|
671838 |
<samp>`--filter'</samp> to redefine REGEX variable default value, and
|
|
|
671838 |
so, control the amount of files to process.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> ARGUMENTS
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Define optional arguments.
|
|
|
671838 |
|
|
|
671838 |
Optional arguments, inside <tt>`centos-art.sh'</tt> script, are considered
|
|
|
671838 |
as all command-line arguments passed to <tt>`centos-art.sh'</tt> script,
|
|
|
671838 |
from third argument position on. For example, in the command
|
|
|
671838 |
<samp>`centos-art render --entry=path/to/dir --filter=regex'</samp> , the
|
|
|
671838 |
optional arguments are from <samp>`--filter=regex'</samp> argument on.
|
|
|
671838 |
|
|
|
671838 |
Optional arguments are parsed using getopt command through
|
|
|
671838 |
the following base construction:
|
|
|
671838 |
|
|
|
671838 |
# Define short options we want to support.
|
|
|
671838 |
local ARGSS=""
|
|
|
671838 |
|
|
|
671838 |
# Define long options we want to support.
|
|
|
671838 |
local ARGSL="filter:,to:"
|
|
|
671838 |
|
|
|
671838 |
# Parse arguments using getopt(1) command parser.
|
|
|
671838 |
cli_doParseArguments
|
|
|
671838 |
|
|
|
671838 |
# Reset positional parameters using output from (getopt) argument
|
|
|
671838 |
# parser.
|
|
|
671838 |
eval set -- "$ARGUMENTS"
|
|
|
671838 |
|
|
|
671838 |
# Define action to take for each option passed.
|
|
|
671838 |
while true; do
|
|
|
671838 |
case "$1" in
|
|
|
671838 |
--filter )
|
|
|
671838 |
REGEX="$2"
|
|
|
671838 |
shift 2
|
|
|
671838 |
;;
|
|
|
671838 |
--to )
|
|
|
671838 |
TARGET="$2"
|
|
|
671838 |
shift 2
|
|
|
671838 |
;;
|
|
|
671838 |
* )
|
|
|
671838 |
break
|
|
|
671838 |
esac
|
|
|
671838 |
done
|
|
|
671838 |
|
|
|
671838 |
Optional arguments provide support to command options inside
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script. For instance, consider the Subversion
|
|
|
671838 |
(svn ) command, where there are many options (e.g.,
|
|
|
671838 |
<samp>`copy'</samp>, <samp>`delete'</samp>, <samp>`move'</samp>, etc), and inside each
|
|
|
671838 |
option there are several modifiers (e.g., <samp>`--revision'</samp>,
|
|
|
671838 |
<samp>`--message'</samp>, <samp>`--username'</samp>, etc.) that can be combined one
|
|
|
671838 |
another in their short or long variants.
|
|
|
671838 |
|
|
|
671838 |
The ARGUMENTS variable is used to store arguments passed from
|
|
|
671838 |
command-line for later use inside <tt>`centos-art.sh'</tt> script. Storing
|
|
|
671838 |
arguments is specially useful when we want to run a command with some
|
|
|
671838 |
specific options from them. Consider the following command:
|
|
|
671838 |
|
|
|
671838 |
centos-art path --copy=SOURCE --to=TARGET --message="The commit message goes here." --username='johndoe'
|
|
|
671838 |
|
|
|
671838 |
In the above command, the <samp>`--message'</samp>, and <samp>`--username'</samp>
|
|
|
671838 |
options are specific to svn copy command. In such cases,
|
|
|
671838 |
options are not interpreted by <tt>`centos-art.sh'</tt> script itself.
|
|
|
671838 |
Instead, the <tt>`centos-art.sh'</tt> script uses getopt to
|
|
|
671838 |
retrive them and store them in the ARGUMENTS variable for later
|
|
|
671838 |
use, as described in the following command:
|
|
|
671838 |
|
|
|
671838 |
# Build subversion command to duplicate locations inside the
|
|
|
671838 |
# workstation.
|
|
|
671838 |
eval svn copy $SOURCE $TARGET --quiet $ARGUMENTS
|
|
|
671838 |
|
|
|
671838 |
When getopt parses ARGUMENTS, we may use short options
|
|
|
671838 |
(e.g., <samp>`-m'</samp>) or long options (e.g., <samp>`--message'</samp>). When
|
|
|
671838 |
we use short options, arguments are separated by one space from the
|
|
|
671838 |
option (e.g., <samp>`-m 'This is a commit message.''</samp>). When we use
|
|
|
671838 |
long options arguments are separated by an equal sign (<samp>`='</samp>)
|
|
|
671838 |
(e.g., <samp>`--message='This is a commit message''</samp>).
|
|
|
671838 |
|
|
|
671838 |
In order for getopt to parse ARGUMENTS correctly, it
|
|
|
671838 |
is required to provide the short and long definition of options that
|
|
|
671838 |
will be passed or at least supported by the command performing the
|
|
|
671838 |
final action the function script exists for.
|
|
|
671838 |
|
|
|
671838 |
As convenction, inside <tt>`centos-art.sh'</tt> script, short option
|
|
|
671838 |
definitions are set in the ARGSS variable; and long option
|
|
|
671838 |
definitions are set in the ARGSL variable.
|
|
|
671838 |
|
|
|
671838 |
When you define short and long options, it may be needed to define
|
|
|
671838 |
which of these option arguments are required and which not. To define
|
|
|
671838 |
an option argument as required, you need to set one colon <samp>`:'</samp>
|
|
|
671838 |
after the option definition (e.g., <samp>`-o m: -l message:'</samp>). On
|
|
|
671838 |
the other hand, to define an option argument as not required, you need
|
|
|
671838 |
to set two colons <samp>`::'</samp> after the option definition (e.g.,
|
|
|
671838 |
<samp>`-o m:: -l message::'</samp>).
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Variable:</u> EDITOR
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Default text editor.
|
|
|
671838 |
|
|
|
671838 |
The <tt>`centos-art.sh'</tt> script uses default text EDITOR to edit
|
|
|
671838 |
pre-commit subversion messages, translation files, configuration
|
|
|
671838 |
files, script files, and similar text-based files.
|
|
|
671838 |
|
|
|
671838 |
If EDITOR environment variable is not set, <tt>`centos-art.sh'</tt>
|
|
|
671838 |
script uses <tt>`/usr/bin/vim'</tt> as default text editor. Otherwise, the
|
|
|
671838 |
following values are recognized by <tt>`centos-art.sh'</tt> script:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<tt>`/usr/bin/vim'</tt>
|
|
|
671838 |
<tt>`/usr/bin/emacs'</tt>
|
|
|
671838 |
<tt>`/usr/bin/nano'</tt>
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
If no one of these values is set in EDITOR environment variable,
|
|
|
671838 |
<tt>`centos-art.sh'</tt> uses <tt>`/usr/bin/vim'</tt> text editor by default.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.52.3.2 Global functions
|
|
|
671838 |
|
|
|
671838 |
Function scripts stored directly under
|
|
|
671838 |
<tt>`trunk/Scripts/Bash/Functions/'</tt> directory are used to define
|
|
|
671838 |
global functions. Global functions can be used inside action specific
|
|
|
671838 |
functionalities and or even be reused inside themselves. This section
|
|
|
671838 |
provides introductory information to global functions you can use
|
|
|
671838 |
inside <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_checkActionArguments
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Validate action value (ACTIONVAL) variable.
|
|
|
671838 |
|
|
|
671838 |
The action value variable can take one of the following values:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Path to one directory inside the local working copy,
|
|
|
671838 |
Path to one file inside the local working copy,
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
If another value different from that specified above is passed to
|
|
|
671838 |
action value variable, the <tt>`centos-art.sh'</tt> script prints an error
|
|
|
671838 |
message and ends script execution.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_checkFiles FILE [TYPE]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Verify file existence.
|
|
|
671838 |
|
|
|
671838 |
cli_checkFiles receives a FILE absolute path and performs
|
|
|
671838 |
file verification as specified in TYPE. When TYPE is not
|
|
|
671838 |
specified, cli_checkFiles verifies FILE existence, no
|
|
|
671838 |
matter what kind of file it be. If TYPE is specified, use one
|
|
|
671838 |
of the following values:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`d'</samp>
|
|
|
671838 |
<samp>`directory'</samp>
|
|
|
671838 |
Ends script execution if FILE is not a directory.
|
|
|
671838 |
|
|
|
671838 |
When you verify directories with cli_checkFiles, if directory doesn't
|
|
|
671838 |
exist, <tt>`centos-art.sh'</tt> script asks you for confirmation in order
|
|
|
671838 |
to create that directory. If you answer positively,
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script creates that directory and continues
|
|
|
671838 |
script flows normally. Otherwise, if you answer negatively,
|
|
|
671838 |
<tt>`centos-art.sh'</tt> ends script execution with an error and
|
|
|
671838 |
documentation message.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`f'</samp>
|
|
|
671838 |
<samp>`regular-file'</samp>
|
|
|
671838 |
Ends script execution if FILE is not a regular file.
|
|
|
671838 |
|
|
|
671838 |
<samp>`h'</samp>
|
|
|
671838 |
<samp>`symbolic-link'</samp>
|
|
|
671838 |
Ends script execution if FILE is not a symbolic link.
|
|
|
671838 |
|
|
|
671838 |
<samp>`x'</samp>
|
|
|
671838 |
<samp>`execution'</samp>
|
|
|
671838 |
Ends script execution if FILE is not executable.
|
|
|
671838 |
|
|
|
671838 |
<samp>`fh'</samp>
|
|
|
671838 |
Ends script execution if FILE is neither a regular file nor a
|
|
|
671838 |
symbolic link.
|
|
|
671838 |
|
|
|
671838 |
<samp>`fd'</samp>
|
|
|
671838 |
Ends script execution if FILE is neither a regular file nor a
|
|
|
671838 |
directory.
|
|
|
671838 |
|
|
|
671838 |
<samp>`isInWorkingCopy'</samp>
|
|
|
671838 |
Ends script execution if FILE is not inside the working copy.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
As default behaviour, if FILE passes all verifications,
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script continues with its normal flow.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_commitRepoChanges [LOCATION]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Syncronize changes between repository and working copy.
|
|
|
671838 |
|
|
|
671838 |
The cli_commitRepoChanges function brings changes from the
|
|
|
671838 |
central repository down to the working copy--using svn
|
|
|
671838 |
update--, checks the working copy changes--using svn
|
|
|
671838 |
status command--, prints status report--using both svn
|
|
|
671838 |
update and svn status commands output, and finally, commits
|
|
|
671838 |
recent changes from the working copy up to the repository--using
|
|
|
671838 |
svn commit command--.
|
|
|
671838 |
|
|
|
671838 |
Previous to commit the working copy changes up to the central
|
|
|
671838 |
repository, the cli_commitRepoChanges function asks you to
|
|
|
671838 |
verify changes--using svn diff command--, and later,
|
|
|
671838 |
another confirmation question is shown to be sure you really want to
|
|
|
671838 |
commit changes up to central repository.
|
|
|
671838 |
|
|
|
671838 |
If LOCATION argument is not specified, the value of
|
|
|
671838 |
ACTIONVAL variable is used as reference instead.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
--> Bringing changes from the repository into the working copy
|
|
|
671838 |
--> Checking changes in the working copy
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
Added 0 file from the repository.
|
|
|
671838 |
Deleted 0 file from the repository.
|
|
|
671838 |
Updated 0 file from the repository.
|
|
|
671838 |
Conflicted 0 file from the repository.
|
|
|
671838 |
Merged 0 file from the repository.
|
|
|
671838 |
Modified 4 files from the working copy.
|
|
|
671838 |
Unversioned 0 file from the working copy.
|
|
|
671838 |
Deleted 0 file from the working copy.
|
|
|
671838 |
Added 0 file from the working copy.
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
|
|
|
671838 |
Figure 2.3: The cli_commitRepoChanges function output.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Call the cli_commitRepoChanges function before or/and after
|
|
|
671838 |
calling functions that modify files or directories inside the working
|
|
|
671838 |
copy as you may need to.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_doParseArguments
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Redefine arguments (ARGUMENTS) global variable using
|
|
|
671838 |
getopt command output. For more information about how to use
|
|
|
671838 |
cli_doParseArguments function, see ARGUMENTS variable
|
|
|
671838 |
description above.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_doParseArgumentsReDef $@
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Initialize/reset arguments (ARGUMENTS) global variable using
|
|
|
671838 |
positional parameters variable ($@) as reference.
|
|
|
671838 |
|
|
|
671838 |
When we work inside function definitions, positional parameters are
|
|
|
671838 |
reset to the last function definition positional parameters. If you
|
|
|
671838 |
need to redefine positional parameters from one specific function, you
|
|
|
671838 |
need to call cli_doParseArgumentsReDef with the positional
|
|
|
671838 |
parameters variable ($@), set as first argument, to that
|
|
|
671838 |
specific function you want to redefine positional parameters at.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getArguments
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Initialize function name (FUNCNAM), action name
|
|
|
671838 |
(ACTIONNAM), and action value (ACTIONVAL) global
|
|
|
671838 |
variables, using positional parameters passed in $@ variable.
|
|
|
671838 |
|
|
|
671838 |
The cli_getArguments function is called from cli.sh
|
|
|
671838 |
function script, using cli function positional parameters
|
|
|
671838 |
(i.e., the positional parameters passed as arguments in the
|
|
|
671838 |
command-line) as first function argument.
|
|
|
671838 |
|
|
|
671838 |
Once command-line positional parameters are accesible to
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script execution evironment,
|
|
|
671838 |
cli_getArguments uses regular expression to retrive
|
|
|
671838 |
action variables from first and second argument. The first argument
|
|
|
671838 |
defines the value used as function name (FUNCNAM), and the
|
|
|
671838 |
second argument defines both values used as action name
|
|
|
671838 |
(ACTIONNAM) and action value (ACTIONVAL), respectively.
|
|
|
671838 |
|
|
|
671838 |
The first argument is a word in lower case. This word specifies the
|
|
|
671838 |
name of the functionality you want to use (e.g., <samp>`render'</samp> to
|
|
|
671838 |
render images, <samp>`manual'</samp> to work on documentation, and so on.)
|
|
|
671838 |
|
|
|
671838 |
The second argument has a long option style (e.g.,
|
|
|
671838 |
<samp>`--option=value'</samp>). The <samp>`--option'</samp> represents the action name
|
|
|
671838 |
(ACTIONNAM), and the characters inbetween the equal sign
|
|
|
671838 |
(<samp>`='</samp>) and the first space character, are considered as the action
|
|
|
671838 |
value (ACTIONVAL). In order to provide action values with space
|
|
|
671838 |
characters inbetween you need to enclose action value with quotes like
|
|
|
671838 |
in <samp>`--option='This is long value with spaces inbetween''</samp>.
|
|
|
671838 |
Generally, action values are used to specify paths over which the
|
|
|
671838 |
action name acts on.
|
|
|
671838 |
|
|
|
671838 |
Once action related variables (i.e., FUNCNAM, ACTIONNAM,
|
|
|
671838 |
and ACTIONVAL) are defined and validated,
|
|
|
671838 |
cli_getArguments shifts the positional arguments to remove the
|
|
|
671838 |
first two arguments passed (i.e., those used to retrive action related
|
|
|
671838 |
variables) and redefine the arguments (ARGUMENTS) global
|
|
|
671838 |
variable with the new positional parameters information.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getFunctions
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Initialize funtionalities supported by <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
Functionalities supported by <tt>`centos-art.sh'</tt> script are organized
|
|
|
671838 |
in functionality directories under
|
|
|
671838 |
<tt>`trunk/Scripts/Bash/Functions/'</tt> directory. Each functionality
|
|
|
671838 |
directory stores function scripts to the functionality such directory
|
|
|
671838 |
was created for. Function scripts contain function definitions.
|
|
|
671838 |
Function definitions contain several commands focused on achieving one
|
|
|
671838 |
specific task only (i.e., the one such functionality was created for).
|
|
|
671838 |
|
|
|
671838 |
In order for <tt>`centos-art.sh'</tt> script to recognize a functionality,
|
|
|
671838 |
such functionality needs to be stored under
|
|
|
671838 |
<tt>`trunk/Scripts/Bash/Functions/'</tt> in a directory written
|
|
|
671838 |
capitalized (i.e., the whole name is written in lowercase except the
|
|
|
671838 |
first character which is in uppercase). The directory where one
|
|
|
671838 |
specific functionality is stored is known as the <samp>`functionality
|
|
|
671838 |
directory'</samp>.
|
|
|
671838 |
|
|
|
671838 |
Inside each functionality directory, the functionalty itself is
|
|
|
671838 |
implemented through function scripts. Function scripts are organized
|
|
|
671838 |
in files independently one another and written in <samp>`camelCase'</samp>
|
|
|
671838 |
format with the function name as prefix. Separation between prefix
|
|
|
671838 |
and description is done using underscore (<samp>`_'</samp>) character.
|
|
|
671838 |
|
|
|
671838 |
In order for <tt>`centos-art.sh'</tt> script to load functionalities
|
|
|
671838 |
correctly, function definition inside function scripts should be set
|
|
|
671838 |
using the <samp>`function'</samp> reserved word, just as in the following
|
|
|
671838 |
example:
|
|
|
671838 |
|
|
|
671838 |
function prefix_doSomething {
|
|
|
671838 |
|
|
|
671838 |
# Do something here...
|
|
|
671838 |
|
|
|
671838 |
}
|
|
|
671838 |
|
|
|
671838 |
The above function definition is just a convenction we use, in order
|
|
|
671838 |
to make identification of function names easier read and automate by
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script initialization commands, once
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script determines which functionality directory
|
|
|
671838 |
to use. Specifically, in order to initialize and export functions,
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script executes all function scripts inside the
|
|
|
671838 |
functionality directory, and later grep on them using a
|
|
|
671838 |
regular expression pattern, where the <samp>`function'</samp> reserved word is
|
|
|
671838 |
used as reference to retrive the function names and export them to
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script execution environment, and so, make
|
|
|
671838 |
function definitions --from function scripts inside the functionality
|
|
|
671838 |
directory-- available for further calls.
|
|
|
671838 |
|
|
|
671838 |
If the functionality specified in the command-line first argument
|
|
|
671838 |
doesn't have a functionality directory, <tt>`centos-art.sh'</tt> script
|
|
|
671838 |
considers the functionality provided in the command-line as invalid
|
|
|
671838 |
functionality and immediatly stops script execution with an error
|
|
|
671838 |
message.
|
|
|
671838 |
|
|
|
671838 |
In order to keep visual consistency among function scripts, please
|
|
|
671838 |
consider using the following function script design model as template
|
|
|
671838 |
for your own function scripts:
|
|
|
671838 |
|
|
|
671838 |
#!/bin/bash
|
|
|
671838 |
#
|
|
|
671838 |
# prefix_doSomething.sh -- This function illustrates function scripts
|
|
|
671838 |
# design model you can use to create your own function scripts inside
|
|
|
671838 |
# centos-art.sh script.
|
|
|
671838 |
#
|
|
|
671838 |
# Copyright (C) YEAR YOURFULLNAME
|
|
|
671838 |
#
|
|
|
671838 |
# This program is free software; you can redistribute it and/or modify
|
|
|
671838 |
# it under the terms of the GNU General Public License as published by
|
|
|
671838 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
671838 |
# (at your option) any later version.
|
|
|
671838 |
#
|
|
|
671838 |
# This program is distributed in the hope that it will be useful, but
|
|
|
671838 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
671838 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
671838 |
# General Public License for more details.
|
|
|
671838 |
#
|
|
|
671838 |
# You should have received a copy of the GNU General Public License
|
|
|
671838 |
# along with this program; if not, write to the Free Software
|
|
|
671838 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
671838 |
# USA.
|
|
|
671838 |
#
|
|
|
671838 |
# ----------------------------------------------------------------------
|
|
|
671838 |
# $Id$
|
|
|
671838 |
# ----------------------------------------------------------------------
|
|
|
671838 |
|
|
|
671838 |
function prefix_doSomething {
|
|
|
671838 |
|
|
|
671838 |
# Do something here...
|
|
|
671838 |
|
|
|
671838 |
}
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getCountryCodes [FILTER]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Output country codes supported by <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
The cli_getCountryCodes function outputs a list with country
|
|
|
671838 |
codes as defined in ISO3166 standard. When FILTER is provided,
|
|
|
671838 |
cli_getCountryCodes outputs country codes that match
|
|
|
671838 |
FILTER regular expression pattern.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getCountryName [FILTER]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Outputs country name supported by <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
The cli_getCountryName function reads one language locale code
|
|
|
671838 |
in the format LL_CC and outputs the name of its related country as in
|
|
|
671838 |
ISO3166. If filter is specified, cli_getCountryName returns the
|
|
|
671838 |
country name that matches the locale code specified in FILTER,
|
|
|
671838 |
exactly.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getCurrentLocale
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Output current locale used by <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
The cli_getCurrentLocale function uses LANG environment
|
|
|
671838 |
variable to build a locale pattern that is later applied to
|
|
|
671838 |
cli_getLocales function output in order to return the current
|
|
|
671838 |
locale that <tt>`centos-art.sh'</tt> script works with.
|
|
|
671838 |
|
|
|
671838 |
The current locale information, returned by
|
|
|
671838 |
cli_getCurrentLocale , is output from more specific to less
|
|
|
671838 |
specific. For example, if <samp>`en_GB'</samp> locale exists in
|
|
|
671838 |
cli_getLocales function output, the <samp>`en_GB'</samp> locale would
|
|
|
671838 |
take precedence before <samp>`en'</samp> locale.
|
|
|
671838 |
|
|
|
671838 |
Locale precedence selection is quite important in order to define the
|
|
|
671838 |
locale type we use for message translations. For example, if
|
|
|
671838 |
<samp>`en_GB'</samp> is used, we are also saying that the common language
|
|
|
671838 |
specification for English language (i.e., <samp>`en'</samp>) is no longer
|
|
|
671838 |
used. Instead, we are using English non-common country-specific
|
|
|
671838 |
language specifications like <samp>`en_AU'</samp>, <samp>`en_BW'</samp>, <samp>`en_GB'</samp>,
|
|
|
671838 |
<samp>`en_US'</samp>, etc., for message translations.
|
|
|
671838 |
|
|
|
671838 |
Use cli_getCurrentLocale function to know what current locale
|
|
|
671838 |
information to use inside <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getFilesList [LOCATION]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Output list of files to process.
|
|
|
671838 |
|
|
|
671838 |
The cli_getFilesList function uses LOCATION variable as
|
|
|
671838 |
source location to build a list of files just as specified by regular
|
|
|
671838 |
expression (REGEX) global variable. Essentially, what the
|
|
|
671838 |
cli_getFilesList function does is using find command
|
|
|
671838 |
to look for files in the location (LOCATION) just as posix-egrep
|
|
|
671838 |
regular expression (REGEX) specifies.
|
|
|
671838 |
|
|
|
671838 |
If LOCATION is not specified when cli_getFilesList
|
|
|
671838 |
function is called, the action value (ACTIONVAL) global variable
|
|
|
671838 |
is used as location value instead.
|
|
|
671838 |
|
|
|
671838 |
By default, if the regular expression (REGEX) global variable is
|
|
|
671838 |
not redefined after its first definition in the cli function,
|
|
|
671838 |
all files that match default regular expression value (i.e.,
|
|
|
671838 |
<samp>`.+'</samp>) will be added to the list of files to process. Otherwise,
|
|
|
671838 |
if you redefine the regular expression global variable after its first
|
|
|
671838 |
definition in the cli function and before calling
|
|
|
671838 |
cli_getFilesList function, the last value you specifed is used
|
|
|
671838 |
instead.
|
|
|
671838 |
|
|
|
671838 |
When you need to customize the regular expression (REGEX) global
|
|
|
671838 |
variable value inside a function, do not redefine the global variable
|
|
|
671838 |
(at least you be absolutly convinced you need to). Instead, set the
|
|
|
671838 |
regular expression global variable as <samp>`local'</samp> to the function you
|
|
|
671838 |
need a customized regular expression value for. If we don't redefine
|
|
|
671838 |
the regular expression global variable as local to the function, or
|
|
|
671838 |
use another name for the regular expression variable (which is not
|
|
|
671838 |
very convenient in order to keep the amount of names to remember low),
|
|
|
671838 |
you may experiment undesired concantenation issues that make your
|
|
|
671838 |
regular expression to be something different from that you expect them
|
|
|
671838 |
to be, specially if the function where you are doing the variable
|
|
|
671838 |
redefinition is called several times during the same script execution.
|
|
|
671838 |
|
|
|
671838 |
As result, the cli_getFilesList re-defines the value of
|
|
|
671838 |
FILES variable with the list of files the find command
|
|
|
671838 |
returned. As example, consider the following construction:
|
|
|
671838 |
|
|
|
671838 |
function prefix_doSomething {
|
|
|
671838 |
|
|
|
671838 |
# Initialize the list of files to process.
|
|
|
671838 |
local FILES=''
|
|
|
671838 |
|
|
|
671838 |
# Initialize location.
|
|
|
671838 |
local LOCATION=/home/centos/artwork/trunk/Identity/Themes/Models/Default
|
|
|
671838 |
|
|
|
671838 |
# Re-define regular expression to match scalable vector graphic
|
|
|
671838 |
# files only. Note how we use the global value of REGEX to build a
|
|
|
671838 |
# new local REGEX value here.
|
|
|
671838 |
local REGEX="${REGEX}.*\.(svgz|svg)"
|
|
|
671838 |
|
|
|
671838 |
# Redefine list of files to process.
|
|
|
671838 |
cli_getFilesList $LOCATION
|
|
|
671838 |
|
|
|
671838 |
# Process list of files.
|
|
|
671838 |
for FILE in $FILES;do
|
|
|
671838 |
cli_printMessages "$FILE" 'AsResponseLine'
|
|
|
671838 |
# Do something else here on...
|
|
|
671838 |
done
|
|
|
671838 |
|
|
|
671838 |
}
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getLangCodes [FILTER]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Outputs language codes supported by <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
cli_getLangCodes function outputs a list of language codes as
|
|
|
671838 |
defined in ISO639 standard. When FILTER is provided,
|
|
|
671838 |
cli_getLangCodes outputs language codes that match FILTER
|
|
|
671838 |
regular expression pattern.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getLangName [FILTER]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Outputs language names supported by <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
cli_getLangName function reads one language locale code in the
|
|
|
671838 |
format LL_CC and outputs the language related name as in ISO639. If
|
|
|
671838 |
filter is specified, cli_getLangName returns the language name
|
|
|
671838 |
that matches the locale code specified in FILTER, exactly.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getLocales
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Output locale codes supported by <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
Occasionally, you use cli_getLocales function to add locale
|
|
|
671838 |
information in non-common country-specific language (<samp>`LL_CC'</samp>)
|
|
|
671838 |
format for those languages (e.g., <samp>`bn_IN'</samp>, <samp>`pt_BR'</samp>, etc.)
|
|
|
671838 |
which locale differences cannot be solved using common language
|
|
|
671838 |
specifications (<samp>`LL'</samp>) into one unique common locale specification
|
|
|
671838 |
(e.g., <samp>`bn'</samp>, <samp>`pt'</samp>, etc.).
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getRepoName NAME TYPE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Sanitate file names.
|
|
|
671838 |
|
|
|
671838 |
Inside <tt>`centos-art.sh'</tt> script, specific functionalities rely both
|
|
|
671838 |
in cli_getRepoName and repository file system organization to
|
|
|
671838 |
achieve their goals. Consider cli_getRepoName function as
|
|
|
671838 |
central place to manage file name convenctions for other functions
|
|
|
671838 |
inside <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
Important cli_getRepoName function doesn't verify file
|
|
|
671838 |
or directory existence, for that purpose use cli_checkFiles
|
|
|
671838 |
function instead.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
The NAME variable contains the file name or directory name you
|
|
|
671838 |
want to sanitate.
|
|
|
671838 |
|
|
|
671838 |
The TYPE variable specifies what type of sanitation you want to
|
|
|
671838 |
perform on NAME. The TYPE can be one of the following
|
|
|
671838 |
values:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`d'</samp>
|
|
|
671838 |
<samp>`directory'</samp>
|
|
|
671838 |
Sanitate directory NAMEs.
|
|
|
671838 |
|
|
|
671838 |
<samp>`f'</samp>
|
|
|
671838 |
<samp>`regular-file'</samp>
|
|
|
671838 |
Sanitate regular file NAMEs.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Use cli_getRepoName function to sanitate file names and
|
|
|
671838 |
directory names before their utilization.
|
|
|
671838 |
|
|
|
671838 |
Use cli_getRepoName when you need to change file name
|
|
|
671838 |
convenctions inside <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
When we change file name convenctions inside cli_getRepoName
|
|
|
671838 |
what we are really changing is the way functions interpret repository
|
|
|
671838 |
file system organization. Notice that when we change a file name
|
|
|
671838 |
(e.g., a function name), it is necessary to update all files where
|
|
|
671838 |
such file name is placed on. This may require a massive substitution
|
|
|
671838 |
inside the repository, each time we change name convenctions in the
|
|
|
671838 |
repository (-- Removed(pxref:trunk Scripts Bash Functions Path) --, for more
|
|
|
671838 |
information).
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getRepoStatus [LOCATION]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Request repository status.
|
|
|
671838 |
|
|
|
671838 |
This function requests the status of a LOCATION inside the
|
|
|
671838 |
working copy using the svn status command and returns the
|
|
|
671838 |
first character in the output line, just as described in svn
|
|
|
671838 |
help status. If LOCATION is not a regular file or a directory,
|
|
|
671838 |
inside the working copy, the <tt>`centos-art.sh'</tt> script prints a
|
|
|
671838 |
message and ends its execution.
|
|
|
671838 |
|
|
|
671838 |
Use this function to perform verifications based a repository
|
|
|
671838 |
LOCATION status.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getTemporalFile NAME
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Output absolute path to temporal file NAME.
|
|
|
671838 |
|
|
|
671838 |
The cli_getTemporalFile function uses <tt>`/tmp'</tt> directory as
|
|
|
671838 |
source location to store temporal files, the <tt>`centos-art.sh'</tt>
|
|
|
671838 |
script name, and a random identification string to let you run more
|
|
|
671838 |
than one <tt>`centos-art.sh'</tt> script simultaneously on the same user
|
|
|
671838 |
session. For example, due the following temporal file defintion:
|
|
|
671838 |
|
|
|
671838 |
cli_getTemporalFile $FILE
|
|
|
671838 |
|
|
|
671838 |
If FILE name is <tt>`instance.svg'</tt> and the unique random string
|
|
|
671838 |
is <samp>`f16f7b51-ac12-4b7f-9e66-72df847f12de'</samp>, the final temporal
|
|
|
671838 |
file, built from previous temporal file definition, would be:
|
|
|
671838 |
|
|
|
671838 |
/tmp/centos-art.sh-f16f7b51-ac12-4b7f-9e66-72df847f12de-instance.svg
|
|
|
671838 |
|
|
|
671838 |
When you use the cli_getTemporalFile function to create
|
|
|
671838 |
temporal files, be sure to remove temporal files created once you've
|
|
|
671838 |
ended up with them. For example, consider the following construction:
|
|
|
671838 |
|
|
|
671838 |
for FILE in $FILES;do
|
|
|
671838 |
|
|
|
671838 |
# Initialize temporal instance of file.
|
|
|
671838 |
INSTANCE=$(cli_getTemporalFile $FILE)
|
|
|
671838 |
|
|
|
671838 |
# Do something ...
|
|
|
671838 |
|
|
|
671838 |
# Remove temporal instance of file.
|
|
|
671838 |
if [[ -f $INSTANCE ]];then
|
|
|
671838 |
rm $INSTANCE
|
|
|
671838 |
fi
|
|
|
671838 |
|
|
|
671838 |
done
|
|
|
671838 |
|
|
|
671838 |
Use the cli_getTemporalFile function whenever you need to
|
|
|
671838 |
create temporal files inside <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_getThemeName
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Output theme name.
|
|
|
671838 |
|
|
|
671838 |
In order for cli_getThemeName function to extract theme name
|
|
|
671838 |
correctly, the ACTIONVAL variable must contain a directory path
|
|
|
671838 |
under <tt>`trunk/Identity/Themes/Motifs/'</tt> directory structure.
|
|
|
671838 |
Otherwise, cli_getThemeName returns an empty string.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<u>Function:</u> cli_printMessage MESSAGE [FORMAT]
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Define standard output message definition supported by
|
|
|
671838 |
<tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
When FORMAT is not specified, cli_printMessage outputs
|
|
|
671838 |
information just as it was passed in MESSAGE variable.
|
|
|
671838 |
Otherwise, FORMAT can take one of the following values:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsHeadingLine'</samp>
|
|
|
671838 |
To print heading messages.
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
$MESSAGE
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsWarningLine'</samp>
|
|
|
671838 |
To print warning messages.
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
WARNING: $MESSAGE
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsNoteLine'</samp>
|
|
|
671838 |
To print note messages.
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
NOTE: $MESSAGE
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsUpdatingLine'</samp>
|
|
|
671838 |
To print <samp>`Updating'</samp> messages on two-columns format.
|
|
|
671838 |
Updating $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsRemovingLine'</samp>
|
|
|
671838 |
To print <samp>`Removing'</samp> messages on two-columns format.
|
|
|
671838 |
Removing $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsCheckingLine'</samp>
|
|
|
671838 |
To print <samp>`Checking'</samp> messages on two-columns format.
|
|
|
671838 |
Checking $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsCreatingLine'</samp>
|
|
|
671838 |
To print <samp>`Creating'</samp> messages on two-columns format.
|
|
|
671838 |
Creating $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsSavedAsLine'</samp>
|
|
|
671838 |
To print <samp>`Saved as'</samp> messages on two-columns format.
|
|
|
671838 |
Saved as $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsLinkToLine'</samp>
|
|
|
671838 |
To print <samp>`Linked to'</samp> messages on two-columns format.
|
|
|
671838 |
Linked to $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsMovedToLine'</samp>
|
|
|
671838 |
To print <samp>`Moved to'</samp> messages on two-columns format.
|
|
|
671838 |
Moved to $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsTranslationLine'</samp>
|
|
|
671838 |
To print <samp>`Translation'</samp> messages on two-columns format.
|
|
|
671838 |
Translation $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsConfigurationLine'</samp>
|
|
|
671838 |
To print <samp>`Configuration'</samp> messages on two-columns format.
|
|
|
671838 |
Configuration $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsResponseLine'</samp>
|
|
|
671838 |
To print response messages on one-column format.
|
|
|
671838 |
--> $MESSAGE
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsRequestLine'</samp>
|
|
|
671838 |
To print request messages on one-column format. Request messages
|
|
|
671838 |
output messages with one colon (<samp>`:'</samp>) and without trailing newline
|
|
|
671838 |
(<samp>`\n'</samp>) at message end.
|
|
|
671838 |
$MESSAGE:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsYesOrNoRequestLine'</samp>
|
|
|
671838 |
To print <samp>`yes or no'</samp> request messages on one-column format. If
|
|
|
671838 |
something different from <samp>`y'</samp> is answered (when using
|
|
|
671838 |
en_US.UTF-8 locale), script execution ends immediatly.
|
|
|
671838 |
|
|
|
671838 |
$MESSAGE [y/N]:
|
|
|
671838 |
|
|
|
671838 |
When we use <tt>`centos-art.sh'</tt> script in a locale different from
|
|
|
671838 |
en_US.UTF-8 , confirmation answer may be different from
|
|
|
671838 |
<samp>`y'</samp>. For example, if you use es_ES.UTF-8 locale, the
|
|
|
671838 |
confirmation question would look like:
|
|
|
671838 |
|
|
|
671838 |
$MESSAGE [s/N]:
|
|
|
671838 |
|
|
|
671838 |
and the confirmation answer would be <samp>`s'</samp>, as it is on Spanish
|
|
|
671838 |
<samp>`sí'</samp> word.
|
|
|
671838 |
|
|
|
671838 |
Definition of which confirmation word to use is set on translation
|
|
|
671838 |
messages for your specific locale information. -- Removed(xref:trunk Scripts
|
|
|
671838 |
Bash Functions Locale) --, for more information about locale-specific
|
|
|
671838 |
translation messages.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsToKnowMoreLine'</samp>
|
|
|
671838 |
To standardize <samp>`to know more, run the following command:'</samp>
|
|
|
671838 |
messages. When the <samp>`AsToKnowMoreLine'</samp> option is used, the
|
|
|
671838 |
MESSAGE value should be set to "$(caller)" . caller
|
|
|
671838 |
is a Bash builtin that returns the context of the current subroutine
|
|
|
671838 |
call. <samp>`AsToKnowMoreLine'</samp> option uses caller builtin
|
|
|
671838 |
output to build documentation entries dynamically.
|
|
|
671838 |
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
To know more, run the following command:
|
|
|
671838 |
centos-art manual --read='path/to/dir'
|
|
|
671838 |
----------------------------------------------------------------------
|
|
|
671838 |
|
|
|
671838 |
Use <samp>`AsToKnowMoreLine'</samp> option after errors and for intentional
|
|
|
671838 |
script termination.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
<samp>`AsRegularLine'</samp>
|
|
|
671838 |
To standardize regular messages on one-column format.
|
|
|
671838 |
|
|
|
671838 |
When MESSAGE contains a colon inside (e.g., <samp>`description:
|
|
|
671838 |
message'</samp>), the cli_printMessage function outputs MESSAGE
|
|
|
671838 |
on two-columns format.
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
Use cli_printMessage function whenever you need to output
|
|
|
671838 |
information from <tt>`centos-art.sh'</tt> script.
|
|
|
671838 |
|
|
|
671838 |
Tip To improve two-columns format, change the following file:
|
|
|
671838 |
trunk/Scripts/Bash/Styles/output_forTwoColumns.awk
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.52.3.3 Specific functions
|
|
|
671838 |
|
|
|
671838 |
The following specific functions of <tt>`centos-art.sh'</tt> script, are
|
|
|
671838 |
available for you to use:
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.52.4 See also
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
2.50 The <tt>`trunk/Scripts/Bash'</tt> Directory
|
|
|
671838 |
|
|
|
671838 |
|
|
|
671838 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
671838 |
[ < ]
|
|
|
671838 |
[ > ]
|
|
|
ee1f37 |
|
|
|
671838 |
[ << ]
|
|
|
671838 |
[ Up ]
|
|
|
671838 |
[ >> ]
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
<font size="-1">
|
|
|
afcfb5 |
This document was generated on March, 2 2011 using texi2html 1.76.
|
|
|
ee1f37 |
</font>
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
|
|
|
ee1f37 |
</body>
|
|
|
ee1f37 |
</html>
|