Update centos-art.sh scripts.
- Previously, when you executed the centos-art.sh script, it used to
pass all the arguments it received through the command-line to
modules directly, without any modification. Such behavior, required
immediate modules to duplicate common option definitions like
--quiet and --yes. This update changes the centos-art.sh script to
separate both common and specific argument interpretation. Common
arguments are interpreted inside the centos-art.sh file itself while
module-specific arguments are interpreted inside module-specific
environments.
As restriction to this design, arguments considered common cannot
accept arguments (e.g., --option="value", or any variant known by
getopt) are not possible. Consider that two getopt calls inside
different levels of the same script may burst into naming collisions
most of times, though it can be used just once. So, when we parse
common arguments we use a tough way inside centos-art.sh file to do
it. This is by defining a list of all possible arguments that can be
considered common and storing all that are not common for processing
by module-specific environments. Inside module-specific environments
we parse arguments using getopt instead, which is much more
confident about option parsing than our tough implementation. It
would be very nice if we find a way to use getopt in the same script
at different levels without any option naming collision.
TIP: Probably you want to convert all that first-level modules
you have into one-purpose independent scripts that load common
functionalities from external files. More or less as you are
doing already. Consider the render first-level module, for
example, you would have centos-art-render.sh instead. So, when
you need to produce content, you will call
centos-art-render.sh file instead of centos-art.sh render.
This way you can have one getopt for each script file and you
can play with symbolic inks to make shorter commands.
When you execute centos-art.sh script, it processes common option
and non-option arguments. Common option arguments are used to set
flags while common non-option arguments contain path information.
Once centos-art.sh script has collected common arguments, it passed
to store module-specific arguments. For this journey, it uses a
variable named TCAR_SCRIPT_ARGUMENT to store non-option arguments
and TCAR_MODULE_ARGUMENT variable to store option arguments (Notice
that these variables are written in singlar but they store
arguments, in plural. They may store one ore more arguments in
them). Later, it passes these values to tcar_setModuleEnvironment
function which initiates the module environment with this
information.
- Previously, centos-art.sh had not a way to debug the script's
execution. This made difficult to see how modules worked exactly
(e.g., known the index position, the order in which they were
executed). This update changes the tcar_setModuleEnvironment
function to print this information when the --debug option is passed
to centos-art.sh script. In order for this debugging information to
be printed, the TCAR_FLAG_DEBUGGER environment variable was added to
centos-art.conf.sh. It is initially set to false (no debug
information is printed out). The debugging information must be
configured by a set of calls to tcar_printMessage function using the
--as-debugger-line option.
- Previously, documentation was set using the form
centos-art.sh-${MODULE_NAME} name (I've gone back an forth in this
at least twice). This update changes the tcar_printHelp function to
remove the "centos-art.sh" string from documentation names leaving
just ${MODULE_NAME} (default). If the first argument is provided to
tcar_printHelp function it must be in the form ${FILE}.sh and
tcar_printHelp will look for documentation for that file inside
module's manuals directory structure. It is important that you don't
duplicate names inside different levels of sub-modules of one single
first-level module. This way you can document all module's files the
first-level module is made of. The first-level module is the only
one which has access to interpret the arguments passed to
centos-art.sh command-line, so it is the only one you can pass the
--help option to.
- Previously, the tcar_setModuleEnvironment only required you to pass
the "${@}" variable as argument. This variable passed all the
command-line arguments directly from the command-line to the
tcar_setModuleEnvironment function which in turn passed them to
module-specific environments for processing through getopt. Because
common-arguments and specific arguments have been separated one
another, and different modules may require different arguments, this
update changes the tcar_setModuleEnvironment to use the -m, -t, and
-g options which specify the module name, the module type and the
module options, respectively.
- Previously, the tcar_printMessage function was using 15 spaces and
one tabular space from left to right to leave space for action
messages and also retain the vertical view of right content. This
amount of space isn't enough for debugging information printed out
on the left side. This update changes the tcar_printMessage function
to increase the available space in the left side from 15 to 25.
- Previously, the --as-response-line, from tcar_printMessage, was
redirecting content to standard output. This update changes
tcar_printMessage to make --as-response-line to redirect output to
standard error.
- The --as-debugger-line was added to tcar_printMessage. This option
prints information to standard output, based on whether --debug
option was provided to centos-art.sh script or not.
- The tcar_printVersion function was updated to use the GNU version's
style. This is, one line for the program and its version. Another
line for the copyright note, and one or more line for the program's
legal status.
- Previously, we were using the tcar_setArguments function to parse
both common and specific module's options. Because parsing common
options is already done at centos-art.sh file, this update changes
the function name from tcar_setArguments to tcar_setModuleArguments
to reflect the fact that it takes care of module-specific arguments
only.
- Previously, the tcar_setModuleEnvironment function was using regular
variables to store module information. This made the function to
load incorrect modules in situations where the new module to load
was at the same level of the previous one. This update changes the
tcar_setModuleEnvironment variable to use array variables instead of
regular variables so it be possible to access the information of
modules already loaded and adjust the module's base directory of
those who share a same parent.
- Previously, the tcar_setModuleEnvironmentScripts,
tcar_unsetModuleEnvironment and tcar_checkModuleName were using
positional parameters to retrieve module information from
tcar_setModuleEnvironment function. These three functions are called
only from tcar_setModuleEnvironment. This update changes these three
functions to retrieve module information from global variables set
in tcar_setModuleEnvironment instead of positional parameters.
- Update Spanish translations for centos-art.sh script.
- Add entry to produce documentation related to
tcar_setModuleEnvironment.sh file. I need to work more in this
documentation, it is very important to understand how the modular
design implemented by centos-art.sh script works. It is also a
source of new ideas for refactoring.
- Previously, the configuration variables related to script identity
were not read-only. This update changes centos-art.conf.sh file to
make configuration variables related to script identity read-only.
- Remove the TCAR_ARGUMENTS variable definition from centos-art.conf.sh
file. The TCAR_ARGUMENTS variable is no longer used inside
centos-art.sh script. See TCAR_SCRIPT_ARGUMENT and
TCAR_MODULE_ARGUMENT instead.
- Remove the tcar_setSubModuleEnvironment function. It is no longer
needed since tcar_setModuleEnvironment is using array variables to
store module information.