Goals
-----

The trunk/Scripts/Bash directory exists to organize the trunk development line of centos-art.sh automation script.  The centos-art.sh script standardizes frequent tasks inside your working copy of CentOS Artwork Repository.

Description
-----------

The best way to understand centos-art.sh automation script is studying its source code.  However, as start point, you may prefer to read an introductory resume before diving into the source code details.

The centos-art.sh script is written in Bash. Most tasks, inside centos-art.sh script, have been organized in many specific functionalities that you can invoke from the centos-art command-line interface.

When you type the centos-art command in your terminal, the operating system trys to execute that command. In order to execute the command, the operating system needs to know where it is, so the operating system uses the PATH environment variable to look for that command's location. If your system was prepared to use CentOS Artwork Repository correctly (see trunk Scripts Bash Functions Verify), you should have a symbolic link inside ~/bin/ directory that points to the centos-art.sh script file. As ~/bin/ directory is, by default, inside PATH environment variable, the execution of centos-art command runs the centos-art.sh script.

When centos-art.sh script is executed, the first it does is executing the trunk/Scripts/Bash/initEnvironment.sh script to initialize global variables (e.g., gettext's variables) and global function scripts.  Global function scripts are located inside trunk/Scripts/Bash/Functions directory and their file names begin with cli. Global function scripts provide common functionalities that can be used anywhere inside centos-art.sh script execution environment.

Once global variables and function scripts have been loaded, centos-art.sh script executes the cli global function from cli.sh function script to retrive command-line arguments and define some default values that may be used later by specific function scripts (see trunk Scripts Bash Functions).

As convenction, the centos-art.sh command-line arguments have the following format:

centos-art arg1 --arg2=val2 --arg3=val3

In the above example, centos-art is the command you use to invoke centos-art.sh script. The arg1 is required and represents the functionality you want to perform (e.g., verify, render, locale, manual, etc.). The remaining arguments are modifiers to arg1. The --arg2 definition is required and represets, specifically, the action inside the functionality you want to perform.  The --arg3 and on, are optional.

Once command-line arguments have been retrived, the centos-art.sh script loads specific functionalities using the cli_getFunctions.sh function script. Only one specific functionality can be loaded at one script execution I.e., you run centos-art.sh script to run just one functionality.

+----------------------------------------------------------------------+
| [centos@host]$ centos-art function --action='value' --option='value' |
+----------------------------------------------------------------------+
| ~/bin/centos-art --> ~/artwork/trunk/Scripts/Bash/centos-art.sh      |
+---v-----------------------------------------v------------------------+
    | centos-art.sh                           |
    +---v---------------------------------v---+
    .   | initEnvironment.sh              |   .
    .   +---------------------------------+   .
    .   | cli $@                          |   .
    .   +---v-------------------------v---+   .
    .   .   | cli_getFunctions        |   .   .
    .   .   +---v-----------------v---+   .   .
    .   .   .   | function1       |   .   .   .
    .   .   .   | function2       |   .   .   .
    .   .   .   | function3       |   .   .   .
    .   .   .   +-----------------+   .   .   .
    .   .   ...........................   .   .
    .   ...................................   .
    ...........................................
Figure: The functionalities initialization environment.

Functionalities are implemented by means of actions.  Once the functionality has been initiazalized, actions initialization take place for that functionality. Actions initialization model is very similar to functions initialization model. But with the difference, that actions are loaded inside function environment, and so, share variables and functions defined inside function environment.

+--------------------------------------+
| cli_getFunctions                     |
+---v------------------------------v---+
.   | function1                    |   .
.   +---v----------------------v---+   .
.   .   | function1_getActions |   .   .
.   .   +---v--------------v---+   .   .
.   .   .   | action 1     |   .   .   .
.   .   .   | action 2     |   .   .   .
.   .   .   | action n     |   .   .   .
.   .   .   +--------------+   .   .   .
.   .   ........................   .   .
.   ................................   .
.   +------------------------------+   .
.   | function2                    |   .
.   +---v----------------------v---+   .
.   .   | function2_getActions |   .   .
.   .   +---v--------------v---+   .   .
.   .   .   | action 1     |   .   .   .
.   .   .   | action 2     |   .   .   .
.   .   .   | action n     |   .   .   .
.   .   .   +--------------+   .   .   .
.   .   ........................   .   .
.   ................................   .
.   +------------------------------+   .
.   | function3                    |   .
.   +---v----------------------v---+   .
.   .   | function3_getActions |   .   .
.   .   +---v--------------v---+   .   .
.   .   .   | action 1     |   .   .   .
.   .   .   | action 2     |   .   .   .
.   .   .   | action n     |   .   .   .
.   .   .   +--------------+   .   .   .
.   .   ........................   .   .
.   ................................   .
........................................
Figure: The actions initialization environment.

Usage
-----

The centos-art.sh script usage information is described inside each specific function documentation (see trunk Scripts Bash Functions).

See also
--------