From 42321ee4fb68a0546a494b01ee23ecf2551f9de1 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Apr 06 2013 18:14:53 +0000 Subject: Repository's weekly update. - Scripts/Bash/Functions/Commons/cli_unsetFunctions.sh: Update comments. - Scripts/Bash/Functions/Commons/cli_printCopyrightInfo.sh: Update comments. - Scripts/Bash/Functions/Commons/cli_printActionPreamble.sh: Deleted. This function is no longer used. Because different functions may have different preamble messages, this is something we don't want centralize as common to all functionalities. Instead, give freedom to each functionality developers to create their own preamble messages. - Scripts/Bash/Functions/Commons/cli_getConfigValue.sh: Update comment. - Scripts/Bash/Functions/Commons/cli_getPathComponent.sh: Update comment. - Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/intro.docbook: Update content. - Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/mission.docbook: Update content. - Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/environment.docbook: Update content. - Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/cliref.docbook: Update content. --- diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash.docbook index dfb1105..33a1e2f 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash.docbook @@ -1,7 +1,7 @@ The <command>centos-art.sh</command> Reference - Version 0.0.4 + Version 0.4 &scripts-bash-intro; diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/cliref.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/cliref.docbook index 883f9d7..a8ff53e 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/cliref.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/cliref.docbook @@ -1,146 +1,57 @@ - Script Command-line Interface + Command-line Interface The centos-art.sh script follows a - conventional command-line interface where there might be - options and non-option arguments in it. As convention, the - first non-option argument passed to - centos-art.sh script will be the name of - the specific function you want to execute (e.g., - render, locale, - help, etc.). This first argument will be - immediately removed from the list of arguments passed to - centos-art.sh script to leave just the - remaining options and non-option arguments passed to it. At - this point, the centos-art.sh script uses - the getopt command to retrieve option + conventional GNU/Linux command-line interface where there + might be options and non-option arguments in it. As convention + to centos-art.sh, the first non-option + argument passed through the command-line will be the name of + the specific function you want to execute (e.g., , , , etc.). This first argument + will be immediately removed from the list of arguments passed + to centos-art.sh script leaving just the + remaining options and non-option arguments passed to it. From + this point on, the centos-art.sh script + uses the getopt command to retrieve option arguments and remove them from the list of arguments passed to centos-art.sh script. - Once option arguments have been removed from list of arguments - passed to centos-art.sh script, non option - arguments are processed then. Non-option arguments will - always be paths pointing directories inside your working copy - of &TCAR;. These paths can be absolute paths or relative paths - considering the working copy root directory as section. For - example, both the absolute path /home/al/Projects/CentOS/artwork/Identity/Themes/ - and the relative path Identity/Themes point to - the same location. - - - To better understand the centos-art.sh - command-line interface, let's consider the real command shown - in as - section. This command shows the entire command as a list of - space-separated arguments. The value of each argument can be - reached using special variable names based on the number of - arguments passed to the command-line. + command-line interface, consider the command shown in . This example + shows the entire command as a list of space-separated + arguments. Each argument passed in the command-line can be + reached using positional variables as described in . - + The command-line interface The command-line interface - ${0} | |${1}| | ${2} | | ${3} | ----------|-|----|-|--------------------------|-|-----------| centos-art render Identity/Images/Themes --with-brands ----------|-|----|-|--------------------------|-|-----------| - - In , the - relation between special variables and arguments has the - following meaning: - - - - - ${0} - - - This variable contains the absolute path to the command - executed. In case your home directory be /home/john the value of this - argument will be expanded to - /home/john/bin/centos-art which is a - symbolic link to the - ${TCAR_WORKDIR}/Scripts/Bash/centos-art.sh - file. - - - - - - ${1} - - - This variable contains the first non-option argument we use to - determine the specific function environment we want to execute - (e.g., render in this case). The position - of this information in the command-line is relevant to - centos-art.sh script and must not be - changed. Possible values to this variable are specified in - . - - - - - - - ${2} - - - This variable contains a non-option argument referring a path - information inside the working copy of &TCAR;. The specific - path information you provide in this variable must be - recognized by specific function environment provided in - ${1} variable. The position of path - information in the command-line is not relevant to - centos-art.sh script and can be changed - whenever it doesn't be interpreted as value to - ${1} variable. - - - - - - ${3} - - - This variable contains an option argument. The specific option - information you provide in this variable must be recognized by - specific function environment provided in - ${1} variable. The position of options in - the command-line is not relevant to - centos-art.sh script and can be changed - whenever it doesn't be interpreted as value to - ${1} variable. - - - - - - - - Common Options + + Option Arguments - As convention, all function specific environments should - provide support for the following common options: + As convention inside the centos-art.sh, all + specific function environments should provide support for the + following option arguments: @@ -148,24 +59,35 @@ centos-art render Identity/Images/Themes --with-brands | - This option makes centos-art.sh script to - shows information about the specific function environment - (e.g., how to execute it, available options, etc.) set as - first non-option argument. For example, if you provide the + This option makes centos-art.sh to shows + information about the specific function environment (e.g., how + to execute it, available options, etc.) set as first + non-option argument. For example, if you provide the centos-art render --help, the centos-art.sh script will display to you - the information related to the Scripts/Bash/Functions/Render - directory. + the information related to functionality. - This information is retrived from The CentOS Artwork + This information is retrieved from The CentOS Artwork Repository File System (tcar-fs) documentation manual. This manual is written in Texinfo format and provides a quick way for you to read and browse documentation related to each directory inside &TCAR; as you work with it from a text terminal. + + + @@ -182,21 +104,18 @@ centos-art render Identity/Images/Themes --with-brands - - - - Specific Options - The specific options used by specific and common function - environments are described in their respective sections. See - and to know which these - sections are. + The specific option arguments used by function environments + are described individually, as part of each function + environment documentation. To know more about the specific + options used by function environments, see and . - - Specific Function Environments +
+ Specific functions environment @@ -239,8 +158,8 @@ centos-art render Identity/Images/Themes --with-brands
- - Common Function Environments +
+ Common functions environment @@ -251,9 +170,168 @@ centos-art render Identity/Images/Themes --with-brands - cli_checkFiles - ... + + cli_checkFiles + + + Standardize conditional expressions applied to files + (including links and directories) inside the + centos-art.sh script. + + + + cli_checkRepoDirSource + + Standardize directories' path construction inside the + working copy, using absolute paths. + + + + cli_expandTMarkers + + Standardize translation markers construction and their + related expansion. + + + + cli_exportFunctions + + Standardize the way specific functionalities are + exported to centos-art.sh script + environment. + + + + cli_getConfigLines + + Standardize the way configuration lines are retrieved + form configuration files. + + + + cli_getConfigSectionNames + + Standardize the way section names are retrieved from + configuration files. + + + + cli_getConfigValue + + Standardize the way configuration values are retrieved + from configuration files. + + + + cli_getFilesList + + Standardize the way list of files are built inside + centos-art.sh script. + + + + cli_getPathComponent + + Standardize the way directory structures are organized + inside the working copy of &TCAR;. + + + + cli_getRepoName + + Standardize files and directories name convection + inside the working copy of &TCAR;. + + + + cli_getTemporalFile + + Standardize temporal files creation. + + + + cli_parseArgumentsReDef + + Initiate/reset and sanitize positional parameters + passed to this function and creates the list of + arguments that getopt will process. + + + + cli_parseArguments + + Redefine the ARGUMENTS global + variable using getopt output. + + + + cli_printCopyrightInfo + + Standardize the copyright information printed on + content produced by centos-art.sh + script. + + + + cli_printMailingList + + Standardize the way mailing list addresses are printed + on content produced by + centos-art.sh script. + + + cli_printMessage + + Standardize the way messages are printed by + centos-art.sh script. + + + + cli_printUrl + + Standardize the way URLs are printed by + centos-art.sh script. + + + + cli_runFnEnvironment + + Standardize the way centos-art.sh + script is called to itself. + + + + cli + + Initiates the centos-art.sh script + command-line interface. + + + + cli_synchronizeRepoChanges + + Standardize the way changes are synchronized between + the working copy and the central repository. + + + + cli_terminateScriptExecution + + Standardize the actions that must be realized just + before leaving the script execution (e.g., cleaning + temporal files). + + + + cli_unsetFunctions + + Unset functionalities from + centos-art.sh script execution + environment. + + + @@ -261,30 +339,231 @@ centos-art render Identity/Images/Themes --with-brands + + Non-Option Arguments + + + Once option arguments have been removed from the list of + arguments passed to centos-art.sh + command-line, non-option arguments are processed then. + Non-option arguments will always be paths pointing to + directories inside your working copy of &TCAR; or + documentation entries pointing to specific sections in a + documentation manual. Paths provided in the command-line can + be absolute or relative considering the root directory of the + working copy as start point. For example, both the absolute + path ${HOME}/Projects/CentOS/artwork/Identity/Themes/ + and the relative path Identity/Themes point to + the same location. Documentation entries, on the other hand, + exist to specify the files inside the Documentation/Models/ + directory structure you want to work with, based on specific + documentation manual components (e.g., manual name, part, + chapter or section). To know more about documentation entries, + see the functionality + reference. + + + + Implementation - When a new function is created to - centos-art.sh script, it is necessary - to consider whether it will use arguments or not. When the - function doesn't need arguments (e.g., it exists to - redefine values related to global variables only) there is - no need to consider a parsing feature for it. However, - when the function does use arguments it is very important - to parse them appropriately (e.g., by using a parsing feature like - that provided by getopt command). + The command-line interface of + centos-art.sh script is implemented + individually for each specific function environments it is + made of. Each specific function environment inside the + centos-art.sh has its own command-line + definition and can differ in options when they are + compared one another. The command-line differences between + specific function environments exist as consequence of the + purpose they were designed for (e.g., different purposes, + different options and arguments). Nevertheless, all + specific function environments use the same base + construction to implement their unique command-line + interfaces (see ). - In this section will describe how to parse arguments (both - option and non-option) inside the - centos-art.sh script. This information - must be used as section whenever you need to create a - new function for centos-art.sh script. + The specific function environments the + centos-art.sh script is made of use the + Scripts/Bash/Functions/Fname/fname_getOptions.sh + file to store the + fname_getOptions + function definition. This function definition is where you + set the relation between actions to be executed and + arguments passed to centos-art.sh + script. + + + + Basically, when you decide to create new function + environments for the centos-art.sh + script, you need to consider whether they will use + arguments from the command-line or not. When the function + environment doesn't need arguments (e.g., it exists to + redefine values related to variables only) there is not + need to consider a parsing feature for it. However, when + you need to interact with a specific function through the + command-line, you should use the + fname_getOptions + function related to your + fname + function environment to define the way such interaction + will take place. This way you can control the possible + arguments your function environment will be able to + interpret from the command-line. + + + + The command-line implementation + + The command-line implementation + + + +function fname_getOptions { + + # Define short options we want to support. + local ARGSS="h,q" + + # Define long options we want to support. + local ARGSL="help,quiet" + + # Redefine ARGUMENTS using getopt(1) command parser. + cli_parseArguments + + # Redefine positional parameters using ARGUMENTS variable. + eval set -- "$ARGUMENTS" + + # Look for options passed through command-line. + while true; do + + case "$1" in + + -h | --help ) + cli_runFnEnvironment help --read --format="texinfo" "tcar-fs::scripts:bash-functions-fname" + shift 1 + exit + ;; + + -q | --quiet ) + FLAG_QUIET="true" + shift 1 + ;; + + -- ) + # Remove the `--' argument from the list of arguments + # in order for processing non-option arguments + # correctly. At this point all option arguments have + # been processed already but the `--' argument still + # remains to mark ending of option arguments and + # beginning of non-option arguments. The `--' argument + # needs to be removed here in order to avoid + # centos-art.sh script to process it as a path inside + # the repository, which obviously is not. + shift 1 + break + ;; + esac + done + + # Redefine ARGUMENTS variable using current positional parameters. + cli_parseArgumentsReDef "$@" + +} + + + + + + + + Using the base structure described in , you can + create new options so your specific function environment + can express its usefulness. For example, if you want your + specific function environment to print a greeting on the + screen when the option is passed + through its command-line, you can modify the base + structure shown above with the following: + +... + + # Define long options we want to support. + local ARGSL="help,quiet,hello" + +... + + --hello ) + cli_printMessage "`gettext "Hello World!"`" + shift 1 + ;; +... + + + + In case you want to provide an option value in the form + , you can do it as described + below: + + + +... + + # Define long options we want to support. + local ARGSL="help,quiet,hello:" + +... + + --hello ) + cli_printMessage "`gettext "Hello"` ${2}" + shift 2 + ;; +... + + + + In this last case, the option value is required. So, if you + provide the option but do not provide + a value for it, an error will be triggered and the script will + finish its execution. To make an option value not-required, + you need to use two colons instead of one when you define the + options, see the following lines: + + + +... + + # Define long options we want to support. + local ARGSL="help,quiet,hello::" + +... + + --hello ) + cli_printMessage "`gettext "Hello"` ${2}" + shift 2 + ;; +... + + + + To know more about the features provided by + getopt command, read its man page (e.g., + typing the man getopt command in your + terminal). This information will also help you to understand + how to improve the command-line interfaces you create for + the function environments of centos-art.sh + script. + + diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/environment.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/environment.docbook index 2f35643..b3a3523 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/environment.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/environment.docbook @@ -1,100 +1,63 @@ - Script Execution Environment + The Execution Environment The execution environment of centos-art.sh - script can be defined as the virtual boundery of memory in - which the script does what it was conceived to do once - executed by a command-line interpreter (e.g., Bash). When you - execute the centos-art.sh script in your - terminal, the interpreter behind it creates a new execution - environment for it which inherits all the variables and - functions set in the shell execution environment and those - exported to it through the - ~/.bash_profile file, as well. + script is organized in four levels. The first level is the + shell environment, the second level is the + command environment, the third level is the + common functions environment and, finally, the + fourth level which contains the specific function + environment, as described in . In this + context, child environments inherit definitions (e.g., + variables and functions) from their parent environments making + possible to logically organize the script in a way that needs + can be isolated one another to follow the paradigm proposed by + Unix developers at Bell Labs when felt that programs + should do one thing well. - - The centos-art.sh script uses the - ~/.bash_profile file to implement - per-user customizations. For example, you can use this file - to set the location of your working copy through the - TCAR_WORKDIR enviroment variable. By default - this variable is set to ${HOME}/artwork, but you can - reset to something different to fit your needs. See . - - - - Once the centos-art.sh script has been - executed, it creates different levels of execution - environments inside the one created by the script itself on - the shell. These different environment levels can be seen as - a tree of execution environments which inherit one another, as - illustrated in . These - different levels of execution evironments are where the - centos-art.sh script is developed in. - - - + The execution environment The execution environment ---------------------------------------------------------------- -Shell execution environment -----|-------------------|-----------------|-------------------- -. |-- TCAR_WORKDIR |-- TCAR_BRAND |-- EDITOR . -. |-- LANG |-- HOME |-- PATH . -. `-- centos-art.sh `-- ... `-- ... . -. ----|------------------------------------------------ . -. centos-art.sh script execution environment . -. ----|--------------------|--------------------------- . -. . |-- CLI_NAME `-- cli() . . -. . |-- CLI_VERSION |-- render() . . -. . |-- CLI_BASEDIR | |-- svg() . . -. . |-- CLI_FUNCDIR | `-- docbook() . . -. . |-- TMPDIR |-- help() . . -. . `-- ... | |-- docbook() . . -. . | `-- texinfo() . . -. . |-- locale() . . -. . |-- cli_printMessage() . . -. . |-- cli_getFilesList() . . -. . `-- ... . . -. ..................................................... . -............................................................... ++----------------------------------------------------------+ +| Shell environment | ++---|-------------------|-----------------|----------------+ +. |-- TCAR_WORKDIR |-- TCAR_BRAND |-- EDITOR . +. |-- LANG |-- HOME |-- PATH . +. `-- centos-art.sh `-- TMPDIR `-- ... . +. +---|--------------------------------------------+ . +. | Command environment | . +. +---|---------------|----------------|-----------+ . +. . |-- CLI_NAME |-- CLI_VERSION `-- ... . . +. . |-- CLI_FUNCDIR `-- CLI_BASEDIR . . +. . | +---------------------------------------+ . . +. . +--| Common functions environment | . . +. . +--|------------------------------------+ . . +. . . | +-------------------------------+ . . . +. . . +--| Specific function environment | . . . +. . . +-------------------------------+ . . . +. . ......................................... . . +. .................................................. . +............................................................ - - The first file the centos-art.sh script - calls is the - Scripts/Bash/Functions/Common/cli.sh - file. This file initializes variables and functions can be - used along the script execution environment lifetime. Such - environment variables are for internal use inside the - centos-art.sh script only and users - shouldn't modify them to customize the script in a per-user - level. Instead, to customize the script behaviour in a - per-user level, users need to make use of environment - variables set in ~/.bash_profile file. - - - - - Environment Variables + + The Shell Environment The centos-art.sh script uses the following - system environment variables: + shell environment variables: @@ -104,12 +67,12 @@ Shell execution environment The PATH environment variable is specific to the operating system and provides search paths for command - execution. By default, the centos-art.sh script links - executable scripts from the centos-art.sh + script links executable scripts from the ~/bin directory which is one of the locations used as search path in this variable. This is how we create the centos-art command from - the centos-art.sh script inside your + the centos-art.sh script inside your working copy. @@ -164,8 +127,7 @@ Shell execution environment ~/.bash_profile, the centos-art.sh script uses /usr/bin/vim as default text - editor. This is the default text editor installed by default - in &TCD;. + editor. This is the text editor installed by default in &TCD;. @@ -234,12 +196,13 @@ Shell execution environment - Each time you need to store temporal files, do it inside the + When you contribute code to centos-art.sh + script and need to create temporal files, do it inside the absolute path specified by this variable. - This variable is initialized inside the + This variable is redefined inside the centos-art.sh script, so if you set it outside it (e.g., in ~/.bash_profile) the value you set there will be overwritten by that one set inside @@ -279,7 +242,7 @@ Shell execution environment - In addition to system environment variables described above, + In addition to shell environment variables described above, the centos-art.sh script adds the following variables inside the ~/.bash_profile file to control the script behaviour in a per-user level: @@ -292,17 +255,22 @@ Shell execution environment The TCAR_WORKDIR environment variable is specific to centos-art.sh script and - controls the working copy default location in the workstation. - This variable doesn't exist just after installing your - workstation. In order for this variable to be customizable you - need to configure your workstation first, as described in - . + controls the working copy default location of &TCAR;. This is + the place in your workstation where &TCAR; file system is + stored for you to work with it. + - By default, when this variable is not set, the - centos-art.sh script assumes the ${HOME}/artwork path as default - location for your working copy. + By default, just after installing your workstation, this + variable will not be found in it and the + centos-art.sh script will finish its + execution with an error message if you try to execute it + without any argument. This behaviour is OK because the + centos-art.sh script doesn't know where you + stored the working copy of &TCAR; in your workstation. In + order for this variable to exist in your workstation you need + to configure your workstation first, as described in . @@ -320,7 +288,7 @@ Shell execution environment directory). - By default, this variable takes centos as + By default, this variable takes centos as value. In case you want to change it to something else, you should consider the following implications: @@ -346,7 +314,7 @@ Shell execution environment The files stored under Identity/Models/Brands should be named using the value of - ${TCAR_BRAND} as sect2. If you change + ${TCAR_BRAND} as section. If you change the value of this variable, you need to be sure the new value set does coincide with the file names you use to store brand information. @@ -359,27 +327,49 @@ Shell execution environment - + + The Command Environment - Environment Functions + + The first file the centos-art.sh script + calls is the + Scripts/Bash/Functions/Commons/cli.sh + file. This file initializes all variables and functions you + will be able to use along the script execution environment + lifetime. Such environment variables are for internal use + inside the centos-art.sh script only and + users shouldn't modify them to customize the script in a + per-user level. Instead, to customize the script behaviour in + a per-user level, you need to make use of your personal + environment variables set in the + ~/.bash_profile file. + Once environment variables are initialized, the centos-art.sh script initializes common and - specific environment functions. + specific environment functions, in that order. + + + Common Function Environment - Common environment functions are stored under Scripts/Bash/Functions/Commons directory and will be available always, both for common environment functions themselves and specific environment functions. + + + + Specific Function Environments + - Specific environment functionalities, on the other hand, are - stored in the Scripts/Bash/Functions/${CLI_FUNCDIRNAM}/${CLI_FUNCNAME}.sh file, where CLI_FUNCDIRNAME is the first argument passed to centos-art.sh script with the first letter @@ -392,7 +382,7 @@ Shell execution environment - In , + In , render, help and locale are all specific environment functions while cli_printMessage and @@ -403,10 +393,11 @@ Shell execution environment Both specific and common environment functions exist to standardize frequent tasks inside &TCAR;. The following - sect2s will describe which these frequent tasks are and the + sections will describe which these frequent tasks are and the way they are standardized using specific and common environment functions. + diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/funref.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/funref.docbook index 65e0693..c67c159 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/funref.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/funref.docbook @@ -1,4 +1,4 @@ -
+ Environment Functions Reference @@ -1290,5 +1290,5 @@ splash.svgz = "Symbols/48/=\BRAND=.png:x48+30+20" -
+
diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/help.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/help.docbook index 55c7e24..fb608c0 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/help.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/help.docbook @@ -140,7 +140,7 @@ The centos-art help command accepts common options described in and the following + linkend="scripts-bash-cliref-options" /> and the following specific options: diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/intro.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/intro.docbook index 885c3de..bf64c16 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/intro.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/intro.docbook @@ -1,7 +1,6 @@ This reference covers the centos-art.sh script mission, name convenctions, command-line interface and execution - environments (which includes common and specific functions). You - can use this reference to understand how the + environments. You can use this reference to understand how the centos-art.sh script works. diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/mission.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/mission.docbook index 384f9e9..283781e 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/mission.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/mission.docbook @@ -1,11 +1,9 @@ -Script Mission +Mission The centos-art.sh script exists to automate - frequent tasks inside &TCAR;. The - centos-art.sh script is organized in - independent functions which try to follow the paradigm of doing - just one thing and do it well. + frequent tasks inside &TCAR;. + diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/nameconvs.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/nameconvs.docbook index 300b525..a041b3a 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/nameconvs.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/nameconvs.docbook @@ -1,20 +1,20 @@ - Script Convenctions + Convenctions ... - Naming Variables + Variable Names ... - Naming Functions + Function Names ... @@ -30,7 +30,7 @@ - 0 — The script completed successfully. + 0 — The script completed successfully without error. diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/prepare.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/prepare.docbook index 2c45229..4fb9cf9 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/prepare.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/prepare.docbook @@ -125,7 +125,7 @@ The centos-art prepare command accepts common options described in and the following + linkend="scripts-bash-cliref-options" /> and the following specific options: diff --git a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/render.docbook b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/render.docbook index 0d98042..dfeefa8 100644 --- a/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/render.docbook +++ b/Documentation/Models/Docbook/Tcar-ug/Scripts/Bash/render.docbook @@ -248,7 +248,7 @@ The centos-art prepare command accepts common options described in and the following + linkend="scripts-bash-cliref-options" /> and the following specific options: diff --git a/Scripts/Bash/Functions/Commons/cli_getConfigValue.sh b/Scripts/Bash/Functions/Commons/cli_getConfigValue.sh index 6d0b247..7798cd3 100755 --- a/Scripts/Bash/Functions/Commons/cli_getConfigValue.sh +++ b/Scripts/Bash/Functions/Commons/cli_getConfigValue.sh @@ -1,8 +1,8 @@ #!/bin/bash # -# cli_getConfigValue.sh -- This function standardizes the way are -# retrieved from configuration files. As arguments, the configuration -# file absolute path, the configuration section name, and the +# cli_getConfigValue.sh -- This function standardizes the way configuration +# files are retrieved from configuration files. As arguments, the +# configuration file absolute path, the configuration section name, and the # configuration option name must be provided. # # Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project diff --git a/Scripts/Bash/Functions/Commons/cli_getPathComponent.sh b/Scripts/Bash/Functions/Commons/cli_getPathComponent.sh index 954d877..9f48933 100755 --- a/Scripts/Bash/Functions/Commons/cli_getPathComponent.sh +++ b/Scripts/Bash/Functions/Commons/cli_getPathComponent.sh @@ -2,9 +2,9 @@ # # cli_getPathComponent.sh -- This function standardizes the way # directory structures are organized inside the working copy of CentOS -# Artwork Repository. You can use this function to retrive information -# from paths (e.g., releases, architectures and theme artistic motifs) -# or the patterns used to build the paths. +# Artwork Repository. You can use this function to retrieve +# information from paths (e.g., releases, architectures and theme +# artistic motifs) or the patterns used to build the paths. # # Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project # diff --git a/Scripts/Bash/Functions/Commons/cli_printActionPreamble.sh b/Scripts/Bash/Functions/Commons/cli_printActionPreamble.sh deleted file mode 100755 index ad4836b..0000000 --- a/Scripts/Bash/Functions/Commons/cli_printActionPreamble.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash -# -# cli_printActionPreamble -- This function standardizes the way -# preamble messages are printed out. Preamble messages are used before -# actions (e.g., file elimination, edition, creation, actualization, -# etc.) and provide a way for the user to control whether the action -# is performed or not. -# -# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or (at -# your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function cli_printActionPreamble { - - # Define short options. - local ARGSS='' - - # Define long options. - local ARGSL='to-create,to-delete,to-locale,to-edit' - - # Initialize message. - local MESSAGE='' - - # Initialize message options. - local OPTION='' - - # Initialize file variable as local to avoid conflicts outside. - # We'll use the file variable later, to show the list of files - # that will be affected by the action. - local FILE='' - - # Initialize arguments with an empty value and set it as local - # variable to this function scope. Doing this is very important to - # avoid any clash with higher execution environments. - local ARGUMENTS='' - - # Prepare ARGUMENTS for getopt. - cli_parseArgumentsReDef "$@" - - # Redefine ARGUMENTS using getopt(1) command parser. - cli_parseArguments - - # Redefine positional parameters using ARGUMENTS variable. - eval set -- "$ARGUMENTS" - - # Define the location we want to apply verifications to. - local FILES=$(echo $@ | sed -r 's!^.*--[[:space:]](.+)$!\1!') - - # Initialize counter with total number of files. - local COUNT=$(echo $FILES | wc -l) - - # Look for options passed through positional parameters. - while true;do - - case "$1" in - - --to-create ) - if [[ $FILES == '--' ]];then - MESSAGE="`gettext "There is no entry to create."`" - OPTION='--as-error-line' - else - MESSAGE="`ngettext "The following entry will be created" \ - "The following entries will be created" $COUNT`:" - OPTION='' - fi - shift 2 - break - ;; - - --to-delete ) - if [[ $FILES == '--' ]];then - MESSAGE="`gettext "There is no file to delete."`" - OPTION='--as-error-line' - else - MESSAGE="`ngettext "The following entry will be deleted" \ - "The following entries will be deleted" $COUNT`:" - OPTION='' - fi - shift 2 - break - ;; - - --to-locale ) - if [[ $FILES == '--' ]];then - MESSAGE="`gettext "There is no file to locale."`" - OPTION='--as-error-line' - else - MESSAGE="`ngettext "Translatable strings will be retrived from the following entry" \ - "Translatable strings will be retrived from the following entries" $COUNT`:" - OPTION='' - fi - shift 2 - break - ;; - - --to-edit ) - if [[ $FILES == '--' ]];then - MESSAGE="`gettext "There is no file to edit."`" - OPTION='--as-error-line' - else - MESSAGE="`ngettext "The following file will be edited" \ - "The following files will be edited" $COUNT`:" - OPTION='' - fi - shift 2 - break - ;; - - -- ) - if [[ $FILES == '--' ]];then - MESSAGE="`gettext "There is no file to process."`" - OPTION='--as-error-line' - else - MESSAGE="`ngettext "The following file will be processed" \ - "The following files will be processed" $COUNT`:" - OPTION='' - fi - shift 1 - break - ;; - esac - done - - # Print out the preamble message. - cli_printMessage "${MESSAGE}" "${OPTION}" --as-stdout-line - for FILE in $FILES;do - cli_printMessage "$FILE" --as-response-line - done - cli_printMessage "`gettext "Do you want to continue?"`" --as-yesornorequest-line - -} diff --git a/Scripts/Bash/Functions/Commons/cli_printCopyrightInfo.sh b/Scripts/Bash/Functions/Commons/cli_printCopyrightInfo.sh index 1582df9..32ebf8c 100755 --- a/Scripts/Bash/Functions/Commons/cli_printCopyrightInfo.sh +++ b/Scripts/Bash/Functions/Commons/cli_printCopyrightInfo.sh @@ -10,9 +10,9 @@ # terms the creator considers better. At this moment I don't feel # very confident about this legal affairs and their legal # implications, but I need to decide what copyright information the -# centos-art.sh script will print out. So, in that sake, I'll assume -# the same copyright information used by The CentOS Wiki -# (http://wiki.centos.org/) as reference. +# centos-art.sh script will print out when it be requested about it. +# So, in that sake, I'll assume the same copyright information used by +# The CentOS Wiki (http://wiki.centos.org/) as reference. # # Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project # @@ -52,9 +52,10 @@ function cli_printCopyrightInfo { --first-year ) - # The former year when I (as part of The CentOS Project) - # started to consolidate The CentOS Project Corporate - # Visual Identity through the CentOS Artwork Repository. + # The former year when I (as collaborator of The CentOS + # Project) started to consolidate The CentOS Project + # Corporate Visual Identity through the CentOS Artwork + # Repository. echo '2009' ;; diff --git a/Scripts/Bash/Functions/Commons/cli_unsetFunctions.sh b/Scripts/Bash/Functions/Commons/cli_unsetFunctions.sh index 00e8695..d7a1194 100755 --- a/Scripts/Bash/Functions/Commons/cli_unsetFunctions.sh +++ b/Scripts/Bash/Functions/Commons/cli_unsetFunctions.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# cli_unsetFunctions.sh -- This function unsets funtionalities from -# `centos-art.sh' script execution evironment. +# cli_unsetFunctions.sh -- This function unsets functionalities from +# `centos-art.sh' script execution environment. # # Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project #